52,797
社区成员
发帖
与我相关
我的任务
分享
Ext.namespace('JpkFrame.common');
JpkFrame.common.JpkImgLabel = Ext.extend(Ext.BoxComponent, {
initComponent: function() {
JpkFrame.common.JpkImgLabel.superclass.initComponent.call(this);
this.addEvents('click');
},
onRender: function(ct, position) { onRender是渲染,可我不知道去掉为什么不可以,而且里面还有两个参数干嘛的
if (!this.el) { //this.el是表示什么啊,el是元素我知道,可this.el我不知道是他哪个元素
this.el = document.createElement('img');
this.el.src = this.src; //这句话我也不理解,为什么 this.el.src = this.src
if (this.forId) { //this.forId我也不知道哪来的
this.el.setAttribute('htmlFor', this.forId); //这句我也不知道要干嘛
}
}
JpkFrame.common.JpkImgLabel.superclass.onRender.call(this, ct, position);
Ext.fly(this.el).on('click',function() { //这个也希望大家解释一下
this.fireEvent('click', this); //这个也希望大家解释一下
},
this);
}
});
Ext.reg('JpkImgLabel', JpkFrame.common.JpkImgLabel);
var myImage = new Ext.BoxComponent({
autoEl: {
tag: 'img',
src: '/images/my-image.jpg'
}
});
var myImage = new Ext.BoxComponent({
autoEl: {
tag: 'img',
src: '/images/my-image.jpg'
}
});