登录 (SAP NetWeaver) 到 SAPUI5 页面后,SAPUI5 随机抛出错误无法找到 ID rootControl 的控件 - EventProvider sap.m.routing.Target。我尝试强制错误登录和注销。经过多次尝试(40次,有时102次...),出现错误。
我的根控制是<App id="rootControl">
在App.view.xml
。
manifest.json
{
"_version": "1.1.0",
"sap.app": {
"_version": "1.1.0",
"id": "HomePage",
"type": "application",
"i18n": "i18n/i18n.properties",
"title": "{{appTitle}}",
"description": "{{appDescription}}",
"applicationVersion": {
"version": "1.0.6"
},
"ach": "CA-UI5-FST"
},
"sap.ui": {
"technology": "UI5",
"deviceTypes": {
"desktop": true,
"tablet": true,
"phone": true
}
},
"sap.ui5": {
"rootView": {
"viewName": "HomePage.view.App",
"type": "XML",
"async": true,
"id": "rootControl"
},
"dependencies": {
"minUI5Version": "1.30",
"libs": {
"sap.m": {},
"sap.ui.core": {}
}
},
"resources": {
"css": [
{
"uri": "css/customStyle.css"
}
]
},
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"settings": {
"bundleName": "HomePage.i18n.i18n"
}
},
"view": {
"type": "sap.ui.model.json.JSONModel",
"settings": {
"defaultOperationMode": "Server",
"defaultBindingMode": "TwoWay",
"defaultCountMode": "None",
"useBatch": false
}
}
},
"routing": {
"config": {
"routerClass": "sap.m.routing.Router",
"viewType": "XML",
"viewPath": "HomePage.view",
"controlId": "rootControl",
"controlAggregation": "pages",
"transition": "slide",
"bypassed": {
"target": "notFound"
},
"async": true
},
"routes": [{
"pattern": ":Layout:",
"name": "apphome",
"target": "home"
}, {
"name": "id",
"pattern": "Id/{Id}/:Layout:",
"target": "id"
}, {
"name": "details",
"pattern": "Details/{Details}/:Replace:",
"target": "details"
}],
"targets": {
"home": {
"viewId": "home",
"viewName": "Homepage",
"viewLevel": 1
},
"notFound": {
"viewId": "notFound",
"viewName": "NotFound",
"transition": "show"
},
"id": {
"viewId": "id",
"viewName": "Id",
"viewLevel": 2
},
"details": {
"viewId": "details",
"viewName": "Details",
"viewLevel": 3
}
}
}
}
}
有什么想法吗?
最佳答案
Randomly SAPUI5 throws error ...
我记得在过去的 UI5 版本中由于竞争条件而遇到了同样的问题:
- 启动应用程序时,
Component.js
由于sap.ui5/rootView/async: true
异步检索 Root View . init
Component.js
内通常会初始化路由器,当 Root View 仍在加载时检索与哈希值对应的目标 View 。- 有时, Root View 无法在目标 View 之前完全加载,从而导致错误 → 目标不知道将其 View 放在哪里。
commit:d054bc1
确保目标等到 Root View 完全加载。
该修复已在 1.54 中发布,但根据更改日志,也应该在 1.52.5+ 中可用。
要查看应用程序正在运行的 UI5 版本,请按 Ctrl + Left Alt + Shift + P 。请将UI5 lib升级到最新稳定版本。
我不建议同步加载 Root View 。
关于sapui5 - UI5 有时会抛出错误 : Control with ID . .. 无法找到 - EventProvider sap.m.routing.Target,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59864205/