改变this作用域
1
通过var me =this;
Ext.define('assign.BaseViewport', {
extend : 'Ext.Viewport',
initComponent : function() {
var me =this;
Ext.get('xjfq_back1').on('click',function(){
me.cardBack();
//直接调用this.cardBack访问不到对应的方法
});
cardBack:function() {
this.cardLayout.layout.setActiveItem(0);
return;
}
});
Done

浙公网安备 33010602011771号