data() {
return {
isCountdown: false, //倒计时状态
time: '', //倒计时
currentTime: 61, // 当前倒计时
}
},
getCode() {
let that = this;
let clock = setInterval(function(){
that.currentTime--;
that.time = that.currentTime + '秒'
if (that.currentTime <= 0) {
clearInterval(clock)
that.time = '',
that.currentTime = 61,
that.isCountdown = false
}
}, 1000); //一秒执行一次
},
网友评论