当您使用 this.getOwnerComponent().getRouter().navTo() 前往页面时是否会触发事件?

Is there an event fired when you travel to a page using this.getOwnerComponent().getRouter().navTo()?

当您使用 this.getOwnerComponent().getRouter().navTo("Something") 导航到页面时,页面上是否有事件触发。当您使用 this.getOwnerComponent().getRouter().navTo("Something").

导航到页面时,有什么方法可以刷新页面

目标页面上的 routeMatched 将被命中。

示例:

return baseController.extend(
    'XPTO', {
        onInit: function () {


            this.mdRoute = this.getRouter().getRoute('yourRoute');
            this.mdRoute.attachMatched(onRouteOrSubRoutesMatched, this);

        },

    });

 function onRouteOrSubRoutesMatched() {

    }

是的,请参阅以下文档主题:

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) {
    // ...
  },
});