发送验证码
// 验证码
countDown () {
this.hqyzm = this.totalTime + 's后重新发送' //这里解决60秒不见了的问题
let clock = window.setInterval(() => {
this.totalTime--
this.hqyzm = this.totalTime + 's后重新发送'
if (this.totalTime < 0) { //当倒计时小于0时清除定时器
window.clearInterval(clock)
this.hqyzm = '重新发送验证码'
this.totalTime = 60
}
},1000)
},
// 发送验证码
sendCode:function(){
var that=this;
var setTime=0;
if(!that.isSend){
that.isSend=true;
setTime=setInterval(function(){
that.wait--;
that.sendColor="color:#999";
that.codeFont=that.wait+"重新发送";
if(that.wait==0){
clearInterval(setTime);
that.codeFont="获取验证码";
that.isSend=false;
that.wait=60;
that.sendColor="color:#ff5b01";
}
},1000)
}
}