SAPUI5 / OpenUI5 - 如何在应用程序文件夹外加载资源?

时间:2015-07-15 15:21:25

标签: sapui5

我找到了几种在当前应用程序文件夹中注册和加载资源的方法(https://sapui5.netweaver.ondemand.com/sdk/docs/guide/9c5a9619f69f4a819f91fc89d9ff56f1.html

但是当我想从当前应用程序外部重用组件或控件时,例如从可重用的自定义ui5-control-library项目中,如何在javascript代码(而不是html文件)中执行此操作?

所以,例如,我当前的应用程序根目录在这里: http://www.example.org/ui5projects/application1 在这个应用程序中,我想从这里加载源代码 http://www.example.org/ui5projects/controllibraryproject 为了在多个项目中重用编码?

据我所知,我必须使用 https://openui5.hana.ondemand.com/docs/api/symbols/jQuery.sap.html#.registerModulePath使用列出的参数或https://openui5.hana.ondemand.com/docs/api/symbols/jQuery.sap.html#.includeScript来实现我想要达到的目标?

我在Adding a custom library as a dependency in SAP Fiori找到了类似的问题,但我没有使用registerModulePath

运行它

1 个答案:

答案 0 :(得分:1)

显然jQuery.sap.registerModulePath(" res"," path")是可行的方法。

但是你需要调用jQuery.sap.require(res');之后