Routes Can';初始化路由器
我在尝试初始化SAPUI5的路由器时遇到问题。 这是我的webapp文件夹结构: 在清单的底部,我定义了所有路由配置、路由和目标:Routes Can';初始化路由器,routes,sapui5,Routes,Sapui5,我在尝试初始化SAPUI5的路由器时遇到问题。 这是我的webapp文件夹结构: 在清单的底部,我定义了所有路由配置、路由和目标: "routing": { "config": { "routerClass": "sap.m.routing.Router", "viewType": "XML", "viewPath": "ar.com.ordago.FSOT.view", "controlId": "app",
"routing": {
"config": {
"routerClass": "sap.m.routing.Router",
"viewType": "XML",
"viewPath": "ar.com.ordago.FSOT.view",
"controlId": "app",
"controlAggregation": "pages",
"transition": "slide",
"async": true
},
"routes": [{
"pattern": "",
"name": "appHome",
"target": "home"
}],
"targets": {
"home": {
"viewId": "home",
"viewName": "Home",
"viewLevel" : 1
}
}
我的App.view:
<mvc:View
controllerName="ar.com.ordago.FSOT.controller.App"
xmlns:l="sap.ui.layout"
xmlns:mvc="sap.ui.core.mvc"
xmlns:core="sap.ui.core"
xmlns:form="sap.ui.layout.form"
xmlns="sap.m">
<App id="app"/>
</mvc:View>
当我运行webapp时,我得到以下错误:无法读取未定义的属性'initialize'
我在这里搜索过,很多人都有类似的问题。但对于每一个建议的解决方案,问题是没有UIcomponent。。。在component.js中调用init函数,但我有它,所以我不知道下一步要做什么来解决这个问题
我感谢你的帮助 已解决
问题是manifest.js中使用的缩进已损坏。所有与路线和导航相关的信息都位于节点“sap.ui5”的同一级别,而它们需要位于该节点的较低级别。
本质上,因为我混合了许多技术,所以我不是通过SAP WebIDE编码的。但是为了解决这个问题,我在WebIDE中加载了这个项目,并且我能够看到错误。
我想在处理SAPUI5控件时,最好通过WebIDE来维护它
<mvc:View
controllerName="ar.com.ordago.FSOT.controller.Home"
xmlns:l="sap.ui.layout"
xmlns:mvc="sap.ui.core.mvc"
xmlns:core="sap.ui.core"
xmlns="sap.m">
<pages>
<Page
id="page"
title="{i18n>title}">
<content>
</content>
</Page>
</Pages>
</mvc:View>
sap.ui.define([
"sap/ui/core/UIComponent",
"sap/m/MessageToast",
"sap/ui/Device",
"sap/ui/model/json/JSONModel",
"./model/models",
"./model/formatter"
], function(UIComponent, MessageToast, Device, JSONModel, models) {
"use strict";
return UIComponent.extend("ar.com.ordago.FSOT.Component", {
metadata: {
manifest: "json"
},
/**
* The component is initialized by UI5 automatically during the startup of the app and calls the init method once.
* @public
* @override
*/
init : function() {
// call the base component's init function
UIComponent.prototype.init.apply(this, arguments);
// set the device model
this.setModel(models.createDeviceModel(), "device");
// create the views based on the url/hash
this.getRouter().initialize();
}