<view @touchmove="handletouchmove" @touchstart="handletouchstart" @touchend="handletouchend" >
</view>
handletouchstart(e) {
this.timeOutEvent = setTimeout(() => {
this.onLongPress(e)
}, 1000); //这里设置定时器,定义长按1000毫秒触发长按事件,时间可以自己改,
return false;
},
handletouchend() {
clearTimeout(this.time); //清除定时器
if (this.time != 0) {
//处理点击时间
}
return false;
},
handletouchmove() {
clearTimeout(this.time); //清除定时器
this.time = 0;
},
onLongPress(e) {
// 处理长按事件
}

叶耳朵
- 发布:2020-04-21 16:41
- 更新:2022-10-28 10:55
- 阅读:10885
uni-app自定义长按事件
分类:uni-app
4 个评论
要回复文章请先登录或注册
就这样吧001
1***@qq.com
cur
菩提下笑看浮生