在 SAPUI5 中,我可以通过这种方式加载本地文件:
jQuery.sap.require("util.someFile");
但是是否可以在需要时使用上述命令或类似方法在某些视图中加载外部库?理想情况下,我正在寻找类似的东西:
theLoadingCommand("some_url");
谢谢
在 SAPUI5 中,我可以通过这种方式加载本地文件:
jQuery.sap.require("util.someFile");
但是是否可以在需要时使用上述命令或类似方法在某些视图中加载外部库?理想情况下,我正在寻找类似的东西:
theLoadingCommand("some_url");
谢谢
Basically it is possible to register a module path to some URL.
jQuery.sap.registerModulePath('external.library', 'http://....'); //not working
There is only one problem with that. UI5 loads the resources via AJAX requests. Your browser will give you an error because you are trying to load files from a different host.
You can include external libraries by including the file in a normal script tag. It is also possible to include requireJS in your project and use its features. Unfortunately, at the moment UI5 doesn't support requireJS out of the box.
SAPUI5 支持 jQuery,因此您可以从控制器扩展标题,例如:
var s = document.createElement("script");
s.type = "text/javascript";
s.src = "http://somedomain.com/somescript";
$("head").append(s);