为什么我的主控制器被称为两次?

时间:2017-11-23 14:28:20

标签: sapui5

所有其他路线都很好,但由于某种原因,主控制器被调用两次。为什么会这样?

onInit: function() {
  var oRouter = this.getOwnerComponent().getRouter();
  oRouter.getRoute("main").attachMatched(this._onRouteMatched, this);
  this.getView().setModel(new JSONModel({
    Jobs: []
  }), "job");
},

这是路由配置吗?

"rootView": {
  "viewName": "CompleteSurvey.view.Main",
  "type": "XML"
},
"routing": {
  "routes": [{
    "name": "main",
    "pattern": "",
    "target": ["main"]
  }],
  "config": {
    "routerClass": "sap.m.routing.Router",
    "viewType": "XML",
    "viewPath": "CompleteSurvey.view",
    "controlId": "app",
    "controlAggregation": "pages"
  },
  "targets": {
    "main": {
      "viewName": "Main"
    }
  }
}

0 个答案:

没有答案