我有一个门户网站(附加的图像),当我单击一个按钮时,我会在面板中(右侧)获得一些图像。现在,我想在单击每个图像时获得一个带有图像ID的警报框。我该如何访问?到目前为止,我已经使用jquery完成了所有工作,现在我正在迁移过程中。这是我的代码的一部分:
items: [{
xtype: 'tabpanel',
width: 600,
activeTab: 0,
flex: 2,
layout: {type: 'fit'},
items: [{
xtype: 'panel',
title: 'Images',
items: [{contentEl:'img',autoScroll:true,height:500 }],
},{
xtype: 'panel',
title: 'Material',
items: [{contentEl:'msg',autoScroll:true,height:500 }]
}]
}]..
您可以在添加图像元素后添加侦听器
{
xtype: 'image',
src: 'some-path',
listeners: {
el: {
click: function() { alert(this.id); }
}
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句