SitesSDK.Utils.addSiteThemeDesign(cssUrl)

此函数在当前页 HTML <head> 标记中创建 link 元素。源设置为 cssUrl 的路径。

参数

注意:

Oracle 官方不支持 Utils 名称空间中的函数。它们将用作示例实施。使用它们时需自担风险。
名称 类型 说明

cssUrl

字符串

当前主题设计的 URL 路径。仅用于远程组件。

本地组件(在 iframe 中实现)必须从页(而不是 URL)提取属性。

用法

此函数通常与从主机站点提取当前主题设计操作结合使用,如以下示例代码中所示:

// fetch current theme design from host site and then add it to the page

SitesSDK.getSiteProperty('theme',function(data){
                // check if we got an url back
                if ( data.url && typeof data.url === 'string' ) {
                                if ( data.url !== '') {
                                          // theme is loaded so dynamically inject theme
                                          SitesSDK.Utils.addSiteThemeDesign(data.url);
                                }
                }
        });