美文网首页
js验证码倒计时

js验证码倒计时

作者: 在下高姓 | 来源:发表于2020-04-13 23:53 被阅读0次
data() {
            return {
                codeMsg: '获取验证码 ',//验证码计时
                count:60,
                timeSet: null,//定时器
            }
        },
 codePassword(){
                let that=this;
                if(that.count==60){
                    that.timeSet=setInterval(function () {
                        that.count--;
                        if(that.count<=0){
                            that.count=60;
                            that.codeMsg="重新获取";
                            clearInterval(that.timeSet)
                        }else {
                            that.codeMsg=that.count+"s后重新获取"
                        }
                    },1000)
                }
            }

相关文章

网友评论

      本文标题:js验证码倒计时

      本文链接:https://www.haomeiwen.com/subject/rckamhtx.html