Tohold

vue60秒倒计时

 

wait:"60",
content:"验证码",
canClick: true,

 

 

 

daojishi(){
if(!this.canClick) return
this.canClick = false
this.content = this.wait + \'秒\' //这里解决60秒不见了的问题
let clock = window.setInterval(() => {
this.wait--
this.content = this.wait + \'秒\'
if (this.wait < 0) { //当倒计时小于0时清除定时器
window.clearInterval(clock)
this.content = \'验证码\'
this.wait = 60
this.canClick = true
}
},1000)

},

 

分类:

技术点:

相关文章: