Возникает ли событие при переходе на страницу с использованием this.getOwnerComponent(). GetRouter(). NavTo()?
Когда вы переходите на страницу с помощью this.getOwnerComponent(). GetRouter(). NavTo("Something"), происходит ли событие на странице чего-либо. Есть ли способ обновить страницу при переходе на нее с помощью this.getOwnerComponent(). GetRouter(). NavTo("Something").
4 ответа
Решение
RouteMatched на целевой странице получит удар.
Пример:
return baseController.extend(
'XPTO', {
onInit: function () {
this.mdRoute = this.getRouter().getRoute('yourRoute');
this.mdRoute.attachMatched(onRouteOrSubRoutesMatched, this);
},
});
function onRouteOrSubRoutesMatched() {
}
Да, см. Следующие разделы документации:
- События, запускаемые централизованно приложением или NavContainer
- События на страницах
- События для
this.getOwnerComponent().getRouter().getRoute(routeName)
, такие как..beforeMatched
patternMatched
return Controller.extend("...", {
// This is Intial function function called on Page Load
onInit: function() {
this._oRouter = UIComponent.getRouterFor(this); // UIComponent required from "sap/ui/core/UIComponent"
this._oRouter.attachRouteMatched(this.onRouteMatched, this);
},
onRouteMatched : function(oEvent) {
// ...
},
});
Рассматривали ли вы использовать EventBus? Посмотрите на ссылки ниже: