标签:清除 his 手机 show getc 验证 false vue etc
// 获取验证码
getCodes(){
const TIME_COUNT = 60;
if (!this.timer) {
this.count = TIME_COUNT;
this.show = false;
this.getcode()
this.timer = setInterval(() => {
if (this.count > 0 && this.count <= TIME_COUNT) {
this.count--;
} else {
this.show = true;
clearInterval(this.timer);
}
}, 1000)
}
},
如果只使用clearInterval(this.timer);关闭定时器的话
在手机上该定时器其实是没有关闭的状态
需要在将定义定时器的属性设置为null
this.timer = null;
标签:清除 his 手机 show getc 验证 false vue etc
原文地址:https://www.cnblogs.com/qdjj/p/14349871.html