连续点击4次显示模态框
<div class="two-main" @click="toClick" ></div>
data () {
return{
num:0,//点击次数
timer0:'',//第一次点击的时间
timer4:'',//第四次点击的时间
popup :false
}
}
methods: {
// 连续4次点击触发显示模态框
toClick(){
this.num++
if(this.num==1){
this.timer0=new Date().getTime()/1000
}
if(this.num==4){
this.timer4= new Date().getTime()/1000
if(this.timer4-this.timer0<=3){
this.nums=0
this.popup = true //显示模态框
}else {
this.nums=0
}
}
},
}