sapui5 - UI5 有时会抛出错误 : Control with ID . .. 无法找到 - EventProvider sap.m.routing.Target

标签 sapui5

登录 (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 版本中由于竞争条件而遇到了同样的问题:

  1. 启动应用程序时,Component.js由于 sap.ui5/rootView/async: true 异步检索 Root View .
  2. init Component.js内通常会初始化路由器, Root View 仍在加载时检索与哈希值对应的目标 View 。
  3. 有时, 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/

相关文章:

javascript - 如何使用 OData 模型将两个数据属性直接绑定(bind)到一个控件属性?

javascript - Uncaught TypeError : this. getView is not a function 在 sap UI5 消息框中的 onPress 事件中

checkbox - 如何以不可编辑的形式垂直对齐复选框?

SAPUI5:在 list 中设置计数模式

javascript - Controller 中的表达式绑定(bind)

css - 如何在 sap.m.DatePicker 中给月份上色?

javascript - UI5 过滤同一列中的多个值

javascript - 在表达式绑定(bind)中使用自定义全局函数

javascript - sapui5 sap.m.popover 无法打开我的控件

javascript - 读取 Javascript 函数参数数据类型信息