0
我在我的UI5应用程序中使用echarts
,所以我需要等待dom准备好然后执行_onObjectMatched
,但是在第一次加载时,如果我将它放在onInit
中,则会触发_onObjectMatched
,但它在onAfterRendering
中不起作用。我把一个日志放在了AfterRendering之后,所以我很确定onAfterRendering被执行了,之后的_onObjectMatched
调用OK。顺便说一句,我正在建立一个主 - 详细页面。为什么如果将attachPatternMatched放入onAfterRendering中,它将无法在第一次加载中工作?
onInit : function() {
this.getRouter().getRoute("object").attachPatternMatched(this._onObjectMatched, this);
}
onAfterRendering: function() {
this.getRouter().getRoute("object").attachPatternMatched(this._onObjectMatched, this);
}
getRouter : function() {
return sap.ui.core.UIComponent.getRouterFor(this);
},