Sapui5 调试器中有关组件的错误,应用程序正常运行
我从头开始设置了一个非常简单的应用程序,以便揭开一些基础知识的神秘面纱。目前只有一个视图可以工作,这意味着组件可以工作(路由在manifest.json中定义,由component.js调用),但存在一个奇怪的调试器错误(见下文) 此外,我看到Component.js正在网络选项卡中加载,但在某一点上,我看到另一次尝试(在加载视图后)获取一个不知道它是关于什么的组件(见下文) 查看失败请求的内部,我看到以下内容: 这不是我的应用程序路径,与所谓的“Flex服务”相关,我不知道它是关于什么的 有人知道这个组件异常来自哪里吗?代码附在下面,看起来很简单 提前感谢, 格雷格 index.htmlSapui5 调试器中有关组件的错误,应用程序正常运行,sapui5,Sapui5,我从头开始设置了一个非常简单的应用程序,以便揭开一些基础知识的神秘面纱。目前只有一个视图可以工作,这意味着组件可以工作(路由在manifest.json中定义,由component.js调用),但存在一个奇怪的调试器错误(见下文) 此外,我看到Component.js正在网络选项卡中加载,但在某一点上,我看到另一次尝试(在加载视图后)获取一个不知道它是关于什么的组件(见下文) 查看失败请求的内部,我看到以下内容: 这不是我的应用程序路径,与所谓的“Flex服务”相关,我不知道它是关于什么的
<!DOCTYPE HTML>
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() {
}
});
}
);
sap.ui.define([
"sap/ui/core/mvc/Controller"
], function (Controller) {
"use strict";
return Controller.extend("zouz.sapui5.skeleton.controller.Main", {
onInit : function () {
},
onBeforeRendering : function() {
}
});
}
Main.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() {
}
});
}
);
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可能应该是控制器,而不是UIComponent
getContentDensityClass
是一个必须在Component.js
中定义自己的函数。它不是框架的一部分。@Marc:Main是一个控制器,复制粘贴错误,对此表示抱歉,主控制器代码现在已就位。感谢这个功能,只使用模板,坚持认为这是框架的一部分。
</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>
{
"_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"
}
}
}
}
}