SAPUI5路由抛出错误“控件(应用程序控件的ID)没有称为页面的聚合”。 [英] SAPUI5 routing throws error "Control (ID of an App control) does not has an aggregation called pages"

查看:214
本文介绍了SAPUI5路由抛出错误“控件(应用程序控件的ID)没有称为页面的聚合”。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Component.js中包含以下路线:

What I have in my Component.js are these routes:

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):

When I try to access the subroute (URL/#/Reports) the application throws (Chrome):


Co ntrol idAppControl没有名为pages的聚合-

Control idAppControl does not has an aggregation called pages -

由于 idAppControl是一个应用程序而引起的混淆具有聚合页面。另外,即使我使用与子路由完全相同的控件(和聚合),第一个主路由也可以很好地工作。

This is confusing due to the fact, that "idAppControl" is an App and therefor HAS an aggregation pages. Also, the first "main" route works pretty well, even though I'm using exactly the same control (and aggregation) as in the subroute.

可能出了什么问题?

推荐答案

我发现了问题所在。有点范围问题。您无法加入与父路线相同的控件。
您可能会产生以下错误消息,并且存在相同的问题:

I've found out what's wrong. It's kinda a "scope" problem. You can't join the same control as your parent route has. You can produce the following error message with the same problem:


找不到ID为IDAppControl的控件

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

In retrospect this seems to be quite logical :D

这篇关于SAPUI5路由抛出错误“控件(应用程序控件的ID)没有称为页面的聚合”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆