zoukankan      html  css  js  c++  java
  • sencha touch list(列表) item(单行)单击事件触发顺序

    测试代码如下

     1 Ext.define('app.view.new.List', {
     2     alternateClassName: 'newList',
     3     extend: 'app.view.util.MyList',
     4     requires: ['app.view.new.Info'],
     5     xtype: 'newList',
     6     config: {
     7         store: 'newList',
     8         listeners: {
     9             itemtaphold: function(list) {
    10                 console.log(11);
    11             },
    12             itemtouchend: function(list) {
    13                 console.log(22);
    14             },
    15             itemtap: function(list, index, target, record, e, eOpts) {
    16                 console.log(33);
    17             },
    18             itemsingletap: function(list) {
    19                 console.log(44);
    20             }
    21         },
    22         itemTpl: new Ext.XTemplate('<div class="left w20"><div class="img" style="background: url({litpic}) no-repeat center;background-size: 100%;"></div></div>', '<div class="right w80"><div class="row">{title}</div><div class="row grayF">{time}</div></div>')
    23     }
    24 });

    测试结果:

    当按键长按时事件触发顺序依次为:itemtaphold -》 按键松开之后 -》 itemtouchend -》 itemtap -》 itemsingletap
    当按键轻点时事件触发顺序依次为:itemtouchend -》 itemtap -》 itemsingletap

    总结:

    itemtouchend,itemtap,itemsingletap事件必然触发

    itemtaphold事件只在长按时触发

    如果需要同时监控长按和轻触事件,需要加入判断参数来防止事件误触发。

  • 相关阅读:
    subprocess模块讲解
    正则
    logging日志模块
    2-30hashlib模块讲解
    json pickle复习 shelve模块讲解
    XML、PyYAML和configparser模块讲解
    os模块
    2-25sys模块和shutil模块讲解
    随机生成模块
    时间模块
  • 原文地址:https://www.cnblogs.com/mlzs/p/3195311.html
Copyright © 2011-2022 走看看