微信小程序倒计时

countDownetCode: function (that) {
    
    var currentTime = that.data.currentTime;
    that.setData({
      time: currentTime + ''
    })
    var interval = setInterval(function () {
      that.setData({
        time: (currentTime - 1) +
        ''
      })
      currentTime--;
      if (currentTime <= 0) {
        clearInterval(interval)
        that.setData({
          time: '重新获取',
          currentTime: 60,
          disabled: false
        })
      }
    }, 1000);
    that.setData({
      interval: interval
    })
  },
原文地址:https://www.cnblogs.com/lujiang/p/8386503.html