2
我想在js视图中使用component.js,但它正在为rootview查找xml文件。请帮助我如何编写此文件,以便我可以在js视图中进行路由。如何在js-views中实现sapui5中的component.js用于路由
jQuery.sap.declare("com.resident.Component");
sap.ui.core.UIComponent.extend("com.resident.Component", {
metadata : {
rootView : "com.resident.residentbhartiya.App",
routing : {
config : {
targetsClass : "sap.m.routing.Targets",
viewPath : "com.resident.residentbhartiya",
controlId : "rootControl",
controlAggregation : "pages",
viewType : "JS"
},
targets : {
page1 : {
viewName : "loginpage",
viewLevel : 0
},
page2 : {
viewName : "homepage",
viewLevel : 1
}
}
}
},
init : function() {
sap.ui.core.UIComponent.prototype.init.apply(this, arguments);
this.getTargets().display("page1");
},
});