版本 ExtJs - 6.2.1 考虑到下面指定的示例代码,我很想知道是否有更好的方法来实现我可以处理一些检查的地方。
Ext.define('MainApp.view.main.MainController', {
extend: 'Ext.app.ViewController',
...
listen: {
controller: {
// listen to some components events
'componentController':{
'event1': 'onEvent1',
'event2': 'onEvent2'
}
}
},
onEvent1: function(){
// can i avoid this and do something better ??
this.commonEventHandlingChecks();
// event 1 handling logic
},
onEvent2: function(){
// can i avoid this and do something better ??
this.commonEventHandlingChecks();
// event 2 handling logic
},
commonEventHandlingChecks: function(){
// some logic to do some custom validations
}
});
不是在我的控制器中的每个侦听器上调用方法“commonEventHandlingChecks”,有没有更好的方法来执行所有常见的事件处理检查。可能通过覆盖控制器或 Ext.util.Event 中的某些方法