我从头开始安装了一个非常简单的应用程序,以使一些基础知识神秘化。此时只有一个视图有效,这意味着该组件可以工作(路由在manifest.json中定义,由Component.js调用),但是有一个奇怪的调试器错误(见下文)
此外,我看到Network。选项卡中正在加载Component.js,但是在某些时候,我看到了另一种尝试(加载视图之后)以获取一个不知道它是关于什么的组件(见下文)< / p>
查看失败的请求,我看到了:
这不是我的应用程序路径,与所谓的“ Flex Services”有关,我不知道它的用途。
有人知道这个Component异常来自何处吗?下面附带的代码似乎很简单。
预先感谢
格雷格
index.html
<!DOCTYPE HTML>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta charset="UTF-8">
<title>Test_space</title>
<script id="sap-ui-bootstrap"
src="resources/sap-ui-core.js"
data-sap-ui-libs="sap.m"
data-sap-ui-theme="sap_belize"
data-sap-ui-compatVersion="edge"
data-sap-ui-xx-bindingSyntax="complex"
data-sap-ui-resourceroots='{"zouz.sapui5.skeleton": "../webapp/"}'>
</script>
<link rel="stylesheet" type="text/css" href="css/style.css">
<script>
sap.ui.getCore().attachInit(function() {
new sap.m.Shell({
appWidthLimited : false,
app: new sap.ui.core.ComponentContainer({
height : "100%",
name : "zouz.sapui5.skeleton"
})
}).placeAt("content");
});
</script>
</head>
<body class="sapUiBody" id="content">
</body>
Component.js
sap.ui.define([
"sap/ui/core/UIComponent"
], function(UIComponent) {
"use strict";
return UIComponent.extend("zouz.sapui5.skeleton.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);
this.getRouter().initialize();
}
});
});
App.controller.js
sap.ui.define([
"zouz/sapui5/skeleton/controller/BaseController",
"sap/ui/model/json/JSONModel"
], function (BaseController, JSONModel) {
"use strict";
return BaseController.extend("zouz.sapui5.skeleton.controller.App", {
onInit : function () {
var oViewModel,
fnSetAppNotBusy,
iOriginalBusyDelay = this.getView().getBusyIndicatorDelay();
oViewModel = new JSONModel({
busy : true,
delay : 0
});
this.setModel(oViewModel, "appView");
fnSetAppNotBusy = function() {
oViewModel.setProperty("/busy", false);
oViewModel.setProperty("/delay", iOriginalBusyDelay);
};
this.getOwnerComponent().getModel().metadataLoaded().
then(fnSetAppNotBusy);
// apply content density mode to root view
// this.getView().addStyleClass(this.getOwnerComponent().getContentDensityClass());
},
onBeforeRendering : function() {
}
});
}
);
Main.controller.js
sap.ui.define([
"sap/ui/core/mvc/Controller"
], function (Controller) {
"use strict";
return Controller.extend("zouz.sapui5.skeleton.controller.Main", {
onInit : function () {
},
onBeforeRendering : function() {
}
});
}
);
App.view.xml
<mvc:View
xmlns:mvc="sap.ui.core.mvc"
controllerName="zouz.sapui5.skeleton.controller.App"
displayBlock="true"
xmlns="sap.m"
xmlns:core="sap.ui.core">
<App id="app"
busy="{appView>/busy}"
busyIndicatorDelay="{appView>/delay}"/>
Main.view.xml
</mvc:View>
<mvc:View controllerName="zouz.sapui5.skeleton.controller.Main"
xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:core="sap.ui.core"
displayBlock="true">
<App>
<pages>
<Page title="Greg test stuff">
<content id="#contentPlaceholder">
<Text text="This is view 1"/>
</content>
</Page>
</pages>
</App>
</mvc:View>
manifest.json
{
"_version": "1.5.0",
"sap.app": {
"id": "zouz.sapui5.skeleton",
"type": "application",
"i18n": "i18n/i18n.properties",
"applicationVersion": {
"version": "1.0.0"
},
"title": "{{appTitle}}",
"description": "{{appDescription}}",
"sourceTemplate": {
"id": "ui5template.basicSAPUI5ApplicationProject",
"version": "1.40.12"
},
"dataSources": {
"mainService": {
"uri": "/DEV/sap/opu/odata/SAP/ZCONTRACTS_SRV/",
"type": "OData",
"settings": {
"odataVersion": "2.0",
"localUri": "localService/metadata.xml"
}
}
}
},
"sap.ui": {
"technology": "UI5",
"icons": {
"icon": "",
"favIcon": "",
"phone": "",
"phone@2": "",
"tablet": "",
"tablet@2": ""
},
"deviceTypes": {
"desktop": true,
"tablet": true,
"phone": true
},
"supportedThemes": ["sap_hcb", "sap_belize"]
},
"sap.ui5": {
"rootView": {
"viewName": "zouz.sapui5.skeleton.view.App",
"type": "XML"
},
"dependencies": {
"minUI5Version": "1.30.0",
"libs": {
"sap.ui.core": {},
"sap.m": {},
"sap.ui.layout": {},
"sap.ushell": {},
"sap.collaboration": {},
"sap.ui.comp": {},
"sap.uxap": {}
}
},
"contentDensities": {
"compact": true,
"cozy": true
},
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"settings": {
"bundleName": "zouz.sapui5.skeleton.i18n.i18n"
}
},
"": {
"dataSource": "mainService",
"preload": true,
"settings": {
"defaultBindingMode": "TwoWay"
}
}
},
"routing": {
"config": {
"routerClass": "sap.m.routing.Router",
"viewType": "XML",
"viewPath": "zouz.sapui5.skeleton.view",
"async": true,
"controlId": "app",
"controlAggregation": "pages",
"bypassed": {
"target": []
}
},
"routes": [{
"name": "Main",
"pattern": "",
"titleTarget": "",
"greedy": false,
"target": ["Main"]
},
{
"name": "Agreement",
"pattern": "AgreementsSet/{objectId}",
"titleTarget": "",
"greedy": false,
"target": ["Agreement"]
}],
"targets": {
"Main": {
"viewType": "XML",
"transition": "slide",
"clearAggregation": "",
"viewName": "Main",
"viewId": "Main",
"viewLevel": 1
},
"Agreement": {
"viewType": "XML",
"transition": "slide",
"clearAggregation": true,
"viewName": "Agreement",
"viewLevel": 2,
"viewId": "Agreement"
}
}
}
}
}