gpt4 book ai didi

sapui5 - 查看休假事件

转载 作者:行者123 更新时间:2023-12-01 06:23:51 24 4
gpt4 key购买 nike

我在 SAPUI5 应用程序中为 View 声明了一个 Controller 。现在我要 View 离开时执行任务 由用户。

已经有可能向 attachRoutePatternMatched 添加回调函数要在用户导航 View 时执行任务,现在我需要一个等效的函数来处理 View 的离开。我用的是 SplitContainer作为父容器

onInit: function() {
this._oRouter = this.getOwnerComponent().getRouter();
this._oRouter.attachRoutePatternMatched(this._routePatternMatched, this);
},

_routePatternMatched: function(oEvent) {
var that = this;
var sRouteTargetName = oEvent.getParameter("name");
if (sRouteTargetName === "myView") {
// perform tasks if the view is opened by the user
}
},

最佳答案

你可以试试这是否有效:

navAway: function(viewName, callback) {
this._oRouter.navTo(viewName);
if(callback && typeof(callback) === "function") {
callback();
}
}

例如 this.navAway("myView", function() { //doStuff });

关于sapui5 - 查看休假事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30758411/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com