在SAP Fiori中加载外部JS所有页面

问题描述

我们拥有一个可以在现有应用程序上运行的软件,SAP Fiori就是其中之一。我们需要要求客户在所有应用程序页面上都包含CDN托管的JavaScript。据我了解,这可能意味着js需要包含在所有Fiori应用程序component.js或index.html中。

是否可以在所有SAP Fiori Apps页面包括启动板)上加载CDN托管脚本?

我是SAP领域的新手,到目前为止,我的研究才使我受益。感谢任何帮助。

解决方法

您需要创建Fiori插件(使用SAP WebIDE)。 Tutorial

文件Component.js:

sap.ui.define([
    "sap/ui/core/Component",],function (Component) {

    return Component.extend("cdntest.Component",{

        metadata: {
            "manifest": "json"
        },init: function () {
            let cdnScript = document.createElement('script');
            cdnScript.setAttribute('src','https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js');
            document.head.appendChild(cdnScript);

        }

    });
});

enter image description here