【问题标题】:Sapui5- Page not displayedSapui5-页面未显示
【发布时间】:2014-12-17 10:46:44
【问题描述】:

我正在尝试使用正确的 MVC 结构在 OpenUI5 中构建一个简单的 Hello World 应用程序。我正在使用 sap.m.App 而不是 SplitApp。 所以我的 App.view.js 看起来像这样:

....
createContent : function(oController) {

    this.setDisplayBlock(true);

    this.app = new sap.m.App("targetAppId", {

    });
    return this.app;
}
.... 

在我的组件中,为了路由,我编写了以下代码:

routing : {
                config : {
                    viewType : "XML",
                    viewPath : "./view",
                    targetControl : "targetAppId",
                    clearTarget : false,
                    transition : "slide"
                },
                routes : [{
                    pattern : "",
                    viewType : "XML",
                    name : "splash",
                    view : "splash",
                    viewPath : "./view",
                    viewLevel : 0,
                }
                ]
              }
            }

我的 App.view.js 和 splash.view.xml 都在 ./view 中。

在我的 component.js 中,我编写了以下代码来加载视图:

createContent : function() {
            var oView = sap.ui.view({
                id : "app",
                viewName : "./view.App",
                type : "JS",
                viewData : {
                    component : this
                }
            });
           return oView;
}

splash.view.xml -

<mvc:View xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m" >
<Page
showHeader="true">
<content>
    <Text text="Hello"/>
</content>
</Page>
</mvc:View>

在执行时,我得到一个空白的蓝色屏幕。由于某种原因,它没有导航到 splash.view.xml。我不知道为什么。请帮忙。

编辑:

如果我将 sap.m.App 更改为 sap.m.SplitApp 并添加 targetAggregation : "masterPages"。一切正常

更新

我所做的是更改 targetAggregation : "pages" 。一切正常。写在这里,以防它帮助别人。

【问题讨论】:

    标签: sapui5


    【解决方案1】:

    使用targetAggregation : "pages",一切正常。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-08
      • 1970-01-01
      • 2014-11-19
      • 2018-05-28
      相关资源
      最近更新 更多