uniapp中长按事件和点击事件冲突问题
解决办法
(自己动手丰衣足食,目前uniapp还没有解决办法)
步骤1 监控触屏事件的开始和结束
@touchstart="touchstartE()"
@touchend="touchendE()"
touchstartE() {
this.touchT = new Date().getTime();
},
touchendE() {
this.touchE = new Date().getTime();
},
步骤2 定义触屏开始时间变量touchT ,触屏结束时间变量touchE
touchT: '', // 触屏开始时间
touchE: '', // 触屏结束时间
步骤3
通过判断触屏时长来解决冲突
if (this.touchE - this.touchT < 350) {
console.log('点击');
}