SAPUI5 路由抛出错误 "Control (ID of an App control) does not has an aggregation called pages"

SAPUI5 routing throws error "Control (ID of an App control) does not has an aggregation called pages"

我的 Component.js 中有这些路线:

routes: [
                {
                    pattern: "",
                    name: "menu",
                    view: "Menu",
                    targetAggregation: "pages",
                    targetControl: "idAppControl",
                    subroutes: [
                        {
                            pattern: "Reports",
                            name: "reports",
                            view: "SplitContainer",
                            targetAggregation: "pages",
                            targetControl: "idAppControl",
                            clearTarget: true
                        }
                    ]
                }
            ]

当我尝试访问子路径 (URL/#/Reports) 时,应用程序抛出 (Chrome):

Control idAppControl does not has an aggregation called pages -

这令人困惑,因为 "idAppControl" 是一个应用程序,因此有一个聚合页面。此外,第一个 "main" 路由工作得很好,即使我使用与子路由完全相同的控制(和聚合)。

有什么问题吗?

我发现问题所在了。这有点 "scope" 问题。您不能加入与父路由相同的控件。 您可以针对相同的问题生成以下错误消息:

Control with ID idAppControl could not be found

我所做的是:

         routes: [
            {
                pattern: "",
                name: "menu",
                view: "Menu",
                targetAggregation: "pages",
                targetControl: "idAppControl"
            },
            {
                pattern: "Reports",
                name: "reports",
                view: "SplitContainer",
                targetAggregation: "pages",
                targetControl: "idAppControl",
                clearTarget: true
            }
        ]

回想起来这似乎很合乎逻辑:D