简单实现vue验证码60秒倒计时功能

网友投稿 671 2023-03-27


简单实现vue验证码60秒倒计时功能

本文实例为大家分享了vue验证码倒计时60秒的具体代码,供大家参考,具体内容如下

html

获取验证码

{{count}} s

js

data(){

return {

show: true,

count: '',

timer: null,

}

},

methods:{

getCode(){

const TIME_COUNT = 60;

if (!this.timer) {

this.count = TIME_COUNT;

this.show = false;

this.timer = setInterval(() =XvIfxUYp> {

if (this.count > 0 && this.count <= TIME_COUNT) {

this.count--;

} else {

this.show = true;

clearInterval(this.timer);

this.timer = null;

}

}, 1000)

http:// }

}

}


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:详解java中反射机制(含数组参数)
下一篇:浅谈Java多线程处理中Future的妙用(附源码)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~