首页 > 其他 > 详细

vue 实现60秒倒计时

时间:2021-01-20 17:35:17      阅读:27      评论:0      收藏:0      [点我收藏+]
data:     
show: true,
count: "",
timer: null,

getCode() {
      const TIME_COUNT = 60;
      if (!this.timer) {
        this.count = TIME_COUNT;
        this.show = false;
        this.timer = setInterval(() => {
          if (this.count > 0 && this.count <= TIME_COUNT) {
            this.count -= 1;
          } else {
            this.show = true;
            clearInterval(this.timer);
            this.timer = null;
          }
        }, 1000);
      }
},

 


      }
    },

vue 实现60秒倒计时

原文:https://www.cnblogs.com/yugueilou/p/14303592.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!