vue中连续点击3次且时间间隔不超过3秒,才显示div(刚开始隐藏的)

num:0,//点击次数
timer0:'',//第一次点击的时间
timer4:'',//第四次点击的时间
centerDialogVisible: false
//      连续4次点击显示模态框
changeAccount(){
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.isShow=!this.isShow
this.num=0
this.centerDialogVisible=true
}else {
this.num=0
}
}
},


*****************************************************************
 我做的一个循环 当点击第四次的时候 判断时间间隔是不是<=3秒 如果真 则显示且计数=0  如果假 计数=0  【其实不管真假num都为0】


原文地址:https://www.cnblogs.com/myfirstboke/p/9958036.html