【发布时间】:2016-07-26 14:53:15
【问题描述】:
我们有一个 SAPUI5 应用程序,我们在其中定义了多个组件(即多个 Component.js 文件),每个组件位于各自的子文件夹中,作为应用程序根目录的直接子级。下图显示了项目结构:
组件 1 指定为 com.test.component1,组件 2 指定为 com.test.component2。共享代码位于root/shared,并定义为每个组件的控制器中的依赖项。
共享/Utils.js:
sap.ui.define([], function () {
"use strict";
return {...};
};
component1/controller/Controller1.js:
sap.ui.define([
"sap/ui/core/mvc/Controller",
"test/shared/Utils"
], function (BaseController, Utils) {
"use strict";
// controller code
});
在本地(或在 WebIDE 中)运行 index.html 文件,这一切正常,但是当我们尝试将不同的组件集成到 Fiori Launchpad 时找不到共享资源(它尝试从 /resources/shared 加载它们) .我们认为这与 Component.js 或 manifest.json 文件中缺少的为引导定义的 data-sap-ui-resourceroots='{"com.test": ""} 有关。
为各个组件注册资源路径com/test/shared 的正确方法是什么?
【问题讨论】:
-
类似问题可以在这里找到:stackoverflow.com/questions/28016642/…
标签: sapui5