所以,我有这个 UI5 应用程序,它在通过 index.html 调用时工作得非常好,但是当我尝试将它称为组件时它会中断(找不到资源、加载失败、404 错误等)。两个应用程序(呼叫者和被呼叫者)都在网关上
这是应用程序文件夹结构。callee_app-Struct.jpg
link to GitHub - https://github.com/mailsandip/component_test
所有视图都在 zui5_trip_confirmation -> views 文件夹下。图像和模型在各自的文件夹中。
component.js 位于 Component 文件夹下,定义为
// define a new UIComponent
jQuery.sap.declare("components.Component");
jQuery.sap.require("sap.ui.core.UIComponent");
jQuery.sap.require("sap.ui.commons.Button");
jQuery.sap.require("sap.ui.table.Table");
//new Component
sap.ui.core.UIComponent.extend("components.Component", {
metadata : {
properties : {
text: "string"
}
}
});
components.Component.prototype.createContent = function(){
/* trying to register the path zui5_trip_confirmation where all the views are stored */
sap.ui.localResources("zui5_trip_confirmation");
// jQuery.sap.registerModulePath('zui5_trip_confirmation','/sap/bc/ui5_ui5/sap/zui5_trip_conf/zui5_trip_confirmation');
this.oView = sap.ui.jsview("idHome", "zui5_trip_confirmation.views.Home");
return this.oView;
};
调用者应用程序将其称为
jQuery.sap.registerModulePath('components','/sap/bc/ui5_ui5/sap/zui5_trip_conf/components');
var oComp1 = sap.ui.getCore().createComponent({
name: "components",
id: "Comp1",
settings: {text: "Hello World"}
});
var oCompCont1 = new sap.ui.core.ComponentContainer("CompCont1", {
component: oComp1
});
oCompCont1.placeAt("content");
当我运行调用者应用程序时,控制台上出现资源未找到错误。基本上,组件无法解析视图/模型/图像的路径。
这里有什么问题?
问候桑迪普