2017-05-09 93 views
0

我目前正在基於SAPUI5開發一個Web應用程序。目前它基於html頁面,但我們必須遷移到動態結構。解決方案將是路由器。我跟着教程噸(真的),嘗試了不同的結構(JS/XML視圖),但路由器返回永諾路由器不會加載視圖

The target intro has a control id or a parent but no 'controlAggregation' was set, so the target could not be displayed. - EventProvider sap.m.routing.Target 

這是我目前的路由器設置:

"routing": { 
      "config": { 
       "routerClass": "sap.m.routing.Router", 
       "viewType": "XML", 
       "viewPath": "xx.xxxxxxx.view", 
       "controlId": "appContainer" 
      }, 
      "routes": [ 
       { 
        "pattern": "", 
        "name": "intro", 
        "target": "intro" 
       } 
      ], 
      "targets": { 
       "intro": { 
        "viewName": "intro" 
       } 
      } 
     } 

控件ID指向我的rootView中的App標記。

我嘗試了非常簡單的視圖(如僅文本),但問題仍然存在。

<mvc:View 
     controllerName = "xx.xxxxxxx.controller.app" 
     xmlns="sap.m" 
     xmlns:mvc="sap.ui.core.mvc" 
     displayBlock="true"> 
     <App id="appContainer"/> 
    </mvc:View> 

回答

0

如錯誤信息所示,路由器不知道應在哪個聚合中添加「intro」視圖。由於控件應用程序具有名爲「pages」的聚合(從NavContainer繼承),因此將"controlAggregation": "pages"包含到屬性"routing"/"config"