Sencha touch 2 单击事件在列表中div不在ipad上工作

Sencha touch 2 单击事件在列表中div不在ipad上工作,sencha-touch-2,Sencha Touch 2,我将html添加到Sencha列表行,onClick在Windows上的Chrome和Safari上运行良好,但单击事件在iPad上不起作用。 请让我知道任何关于在iPad上工作的建议 Sencha小提琴示例: 代码: var store=Ext.create('Ext.data.store'{ 字段:['htmlRow'], 自动加载:对, }); 添加([{“htmlRow”:“单击1单击2”}]); add([{“htmlRow”:“Edt”}]); add([{“htmlRow”:“J

我将html添加到Sencha列表行,onClick在Windows上的Chrome和Safari上运行良好,但单击事件在iPad上不起作用。 请让我知道任何关于在iPad上工作的建议

Sencha小提琴示例:

代码:

var store=Ext.create('Ext.data.store'{
字段:['htmlRow'],
自动加载:对,
});
添加([{“htmlRow”:“单击1单击2”}]);
add([{“htmlRow”:“Edt”}]);
add([{“htmlRow”:“Jamie”}]);
add([{“htmlRow”:“Aaron”}]);
add([{“htmlRow”:“Dave”}]);
add([{“htmlRow”:“Michael”}]);
add([{“htmlRow”:“Abraham”}]);
add([{“htmlRow”:“Jay”}]);
//定义应用程序
外部应用程序({
启动:函数(){
Ext.Viewport.add({
宽度:“100%”,
高度:“100%”,
对,,
hideOnMaskTap:错,
布局:“适合”,
项目:[{
xtype:'列表',
disableSelection:正确,
itemTpl:“{htmlRow}”,
商店:商店
}]
});
}
});
函数函数函数单击1(){
警告(“为什么点击1可以在Windows中使用Safari和Google Chrome,但不能在Ipad上使用!”);
}
函数func_click2(){
警告(“为什么这个Click 2在Windows中使用Safari和Google Chrome,但不在Ipad上使用!”);
}

原因是“onclick”不能与点击输入设备(我指的是触摸设备)一起使用,因为它是为名称所述的点击而设计的

当列表中的某一行被触摸时,获得反馈的正确(ST2)方法是收听列表中的“itemtap”事件:

...
items: [{
            xtype: 'list',
            disableSelection:true,  

            itemTpl: '<strong>{htmlRow}</strong>',
            store: store,
            listeners: {
                 itemtap : function(list, index, target, record, event) {
                     // your code here
                 }
        }]
 ...
。。。
项目:[{
xtype:'列表',
disableSelection:正确,
itemTpl:“{htmlRow}”,
店:店,,
听众:{
itemtap:函数(列表、索引、目标、记录、事件){
//你的代码在这里
}
}]
...

在“itemtap”事件中,您可以检查“event”参数以确定列表项目的哪个区域被点击。在您的情况下,您可以执行以下操作:

  • 1) 将id添加到第一行的两个div:

    添加([{“htmlRow”:“
    单击1单击2”
    }])

  • 2) 在itemtap侦听器中:

    itemtap : function(list, index, target, record, event) {
        console.log(event.target.id);
        if (event.target.id=='area1') {
            alert('area1 clicked!');
        }
        if (event.target.id=='area1') {
            alert('area2 clicked!');
        }
    }
    
请注意,如果需要,“事件”参数中有更多信息


希望这能有所帮助。

谢谢,我知道这段代码,但我希望(div1,div2)有两个侦听器,而不是一个侦听器。
itemtap : function(list, index, target, record, event) {
    console.log(event.target.id);
    if (event.target.id=='area1') {
        alert('area1 clicked!');
    }
    if (event.target.id=='area1') {
        alert('area2 clicked!');
    }
}