简体   繁体   English

SapUI5 includeScript没有在fiori启动板中加载js文件

[英]SapUI5 includeScript is not loading js files in fiori launch pad

I have a UI5 component on instantiating that component I start loading OL3 library like this, 我有一个UI5组件实例化该组件我开始像这样加载OL3库,

var promise = jQuery.sap.includeScript({
                     url : //ol3Path,
                     id : 'ol3'
                 })
promise.then(function(){
   console.log("OL3 library loaded.");
})

And I am trying to instantiate this component inside the UI5 custom control and placing that inside the div that I created in the custom control renderer And i am instantiating this custom control in FIORI Launchpad , So in summary on instantiating that custom control, I load libraries. 我试图在UI5自定义控件中实例化这个组件,并将其放在我在自定义控件渲染器中创建的div中。我在FIORI Launchpad中实例化这个自定义控件,所以在实例化该自定义控件的摘要中,我加载了库。 but after loading like this I am getting that console message also but once I loaded this there is a global variable ol I am not able to access this variable.How to fix this? 但加载这样之后我得到的是控制台消息也不过一旦我装这有一个全局变量我无法访问此variable.How解决这一问题?

加载ol库 在此输入图像描述 在此输入图像描述

you can follow the below blog: https://blogs.sap.com/2013/02/11/sapui5-with-google-maps/ 你可以按照以下博客: https//blogs.sap.com/2013/02/11/sapui5-with-google-maps/

(or) (要么)

When you want to use external API's in component file use your code and use jQuery.sap.registerModulePath(). 如果要在组件文件中使用外部API,请使用您的代码并使用jQuery.sap.registerModulePath()。 Tis will make your global variable work. 这将使您的全局变量工作。

Finally I got the problem, Currently, i am using requirejs in my fiori project so if there is requirejs then all other ways of loading the library will not work. 最后我遇到了问题,目前,我在我的fiori项目中使用requirejs ,所以如果有requirejs那么加载库的所有其他方式将无法工作。 So once I removed requirejs then it's loading all the libraries properly. 所以一旦我删除了requirejs,它就会正确加载所有库。

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

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