Extjs 将事件附加到initComponent中的Ext.component.component

Extjs 将事件附加到initComponent中的Ext.component.component,extjs,extjs4.2,Extjs,Extjs4.2,我有以下代码 Ext.define(foo.MyComponent, { extend: 'Ext.Component', tpl: new XTemplte({'blah blah'}), data: {}, initComponent: function(){ this.callParent(arguments); this.on('click', function () {alert(1)}); } }); 这是正确的渲染。但是我

我有以下代码

Ext.define(foo.MyComponent, {
   extend: 'Ext.Component',
   tpl: new XTemplte({'blah blah'}),
   data: {},
   initComponent: function(){
       this.callParent(arguments);
       this.on('click', function () {alert(1)});
   }
});

这是正确的渲染。但是我在initComponent中附加的单击事件没有得到注册。我错过什么了吗?我正在使用extjs4.2.1

您的组件是否触发了点击事件?因为Ext.组件没有。mouseover和mouseout呢?我从哪里可以得到这个细节?不。这些都是DOM事件。文档列出了特定组件支持的所有事件:事件处理教程问题已得到充分回答: