我每次查看页面时都会搜索模式以执行代码(在我的情况下,检索数据以便从服务器可视化)(每个tipe页面都由splitApp.toDetail或splitApp.backDetail调用).我该怎么做??onBeforeRendering和onAfterRendering仅在第一次执行..
Hao*_*jie 13
有一个解决方案给你.每次触发导航时都会发生一个名为routeMatched的事件.您可以在详细信息页面中附加事件.
onInit : function () {
this._oRouter = sap.ui.core.UIComponent.getRouterFor(this);
this._oRouter.attachRouteMatched(this.handleRouteMatched, this);
},
handleRouteMatched : function (evt) {
//Check whether is the detail page is matched.
if (evt.getParameter("name") !== "detail") {
return;
//You code here to run every time when your detail page is called.
}
Run Code Online (Sandbox Code Playgroud)
问候,艾伦
我onBeforeShow
在目标视图中使用它.
onBeforeShow : function(evt) {
// gets called everytime the user
// navigates to this view
},
Run Code Online (Sandbox Code Playgroud)
这是触发功能由一个NavContainer在导航的情况下,它的孩子.它记录在NavContainerChild中.
如果使用路由,另一个版本的Allen的代码:
onInit : function () {
this._oRouter = sap.ui.core.UIComponent.getRouterFor(this);
this._oRouter.getRoute("detail").attachMatched(this.handleRouteMatched, this);
},
handleRouteMatched : function (evt) {
//You code here to run every time when your detail page is called.
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
10906 次 |
最近记录: |