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

  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)
  },

 

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

上一篇:微信小程序echarts层级太高


下一篇:C++中虚基类在派生类中的内存布局