首页 > 微信 > 详细

微信小程序获取验证码倒计时

时间:2018-08-31 20:44:16      阅读:213      评论:0      收藏:0      [点我收藏+]
  getVerificationCode: function() {
    var that = this;
    var currentTime = that.data.currentTime;
    that.setData({
      codename: currentTime + ‘秒‘,
      disabled:true
    })
    var interval = setInterval(function() {
      that.setData({
        codename: (currentTime - 1) + ‘秒‘
      })
      currentTime--;
      if (currentTime <= 0) {
        clearInterval(interval)
        that.setData({
          codename: ‘重新获取‘,
          currentTime: 60,
          disabled: false
        })
      }
    }, 1000)
  },

 

微信小程序获取验证码倒计时

原文:https://www.cnblogs.com/lglblogadd/p/9567372.html

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