美文网首页
小程序点击和长按时间处理

小程序点击和长按时间处理

作者: hao_developer | 来源:发表于2022-08-25 12:53 被阅读0次
<image catchtap="seeImg" bindlongtap="longTap" data-index="{{index}}" bindtouchstart="bindTouchStart" bindtouchend="bindTouchEnd" mode="aspectFill" class="item-img item-common-img" src="{{item}}"></image>
data:{
 startTime: 0, //触摸删除按钮时
 endTime: 0, //触摸删除按钮后  
}
bindTouchStart(e) {
  this.data.startTime = e.timeStamp;
},
bindTouchEnd(e) {
  this.data.endTime = e.timeStamp;
},
longTap(e) {//长按事件
},
seeImg(e) {//点击事件
  const selfThis = this;
  if ((selfThis.data.endTime - selfThis.data.startTime) < 350) {
    //todo 点击事件
  }
 }

相关文章

网友评论

      本文标题:小程序点击和长按时间处理

      本文链接:https://www.haomeiwen.com/subject/clnagrtx.html