> countTime(time) {
this.disabled = true
this.timer = setInterval(()=>{
time --
if(time === 0){
this.text = "发送验证码"
clearInterval(this.timer)
this.disabled = false
return
}else{
this.text = time + ' s'
}
},1000)
}
点击验证码的时候执行
this.countTime(60);
时间会一直倒计时下去
试了一下,并没有啊,在0的时候结束了倒计时。
