为什么onBeforeFirstShow有效? [英] Why does onBeforeFirstShow work?
问题描述
我一直在学习主 - 详细演示,下面是的一个片段.Master.controller.js
I have been learning the master-detail demo, below is a snippet in Master.controller.js
onInit : function() {
this.getView().addEventDelegate({
onBeforeFirstShow: function () {
this.getOwnerComponent().oListSelector.setBoundMasterList(oList);
}.bind(this)
});
}
我无法理解该事件代理,因为我还没有看到 onBeforeFirstShow
事件在任何控件/视图API文档中。
I can not understand that event delegate because I haven't seen onBeforeFirstShow
event is in any control/view API doc.
这是用户定义的事件还是预先定义的事件活动?
Is this is a just user-defined event or a pre-defined event?
我试过了
this.getView().addEventDelegate({
onBeforeFirstShow: function () {
console.log("onBeforeFirstShow");
}.bind(this),
onAfterRendering: function () {
console.log("onAfterRendering");
}.bind(this)
});
似乎它发生在 onAfterRendering
之前。此外:
It seems that it happens before onAfterRendering
. Besides:
-
this.getView()。onAfterRendering
返回function
-
this.getView()。onBeforeFirstShow
返回undefined
。
this.getView().onAfterRendering
returnedfunction
this.getView().onBeforeFirstShow
returnedundefined
.
我在 Controller 和查看,以及 sap.ui.core.mvc.Controller 和 sap.ui.core.mvc.View 。只有四种生命周期方法。
I have searched in doc of Controller and View, and source code of sap.ui.core.mvc.Controller and sap.ui.core.mvc.View. There are only four lifecycle methods.
推荐答案
事件 beforeFirstShow
可用对于视图,因为视图是 NavContainer
。除此之外,目前还有
The event beforeFirstShow
is available for the view because the view is a direct aggregation child of NavContainer
. Other than that, there are currently also
-
afterHide
-
afterShow
-
beforeHide
-
beforeShow
afterHide
afterShow
beforeHide
beforeShow
这些事件由 sap.m.NavContainer $当导航发生并显示/隐藏子控件时,其子控件(在我们的例子中是视图)的c $ c>
。
Those events are triggered by sap.m.NavContainer
on its child controls (in our case, the view) when navigation occurs and child controls are displayed/hidden.
这篇关于为什么onBeforeFirstShow有效?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!