简体   繁体   English

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

[英]Loading External JS in SAP Fiori all pages

We have a software that runs as an overlay on existing applications, SAP Fiori being one of them.我们有一款软件可以叠加在现有应用程序上运行,SAP Fiori 就是其中之一。 We need to ask our client to include the CDN hosted JavaScript on all application pages.我们需要要求我们的客户在所有应用程序页面上包含 CDN 托管的 JavaScript。 As I understand this might mean the js needs to be included in all Fiori app component.js or index.html.据我了解,这可能意味着 js 需要包含在所有 Fiori 应用程序 component.js 或 index.html 中。

Is there a way, to load the CDN hosted script on All SAP Fiori Apps pages including launchpad?有没有办法在所有 SAP Fiori Apps 页面(包括启动板)上加载 CDN 托管脚本?

I am new to the SAP world and my research only got me so far.我是 SAP 世界的新手,我的研究只让我到此为止。 Appreciate any help.感谢任何帮助。

You need to create Fiori plug-in (using SAP WebIDE).您需要创建 Fiori 插件(使用 SAP WebIDE)。 Tutorial 教程

File Component.js:文件 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); } }); });

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM