<div
class="main_content"
@mousedown="loopZoom()"
@mouseup="clearLoopZoom()"
@click="handlerZoom()"
>
测试长按
</div>
handlerZoom() {
if (this.flag) {
console.log('执行click事件')
}
this.flag = false
},
loopZoom() {
console.log("长按开始咯")
this.firstTime = new Date().getTime()
this.timeOut = setTimeout(() => {
console.log("长按事件")
}, 800);
},
clearLoopZoom() {
console.log("长按结束咯")
this.lastTime=new Date().getTime()
if (this.lastTime - this.firstTime < 100) {
this.flag=true
}
clearTimeout(this.timeOut);
this.timeOut = "";
clearInterval(this.setIntervals);
this.setIntervals = "";
},