验证码倒计时

    getAuthCode(){
      if (!this.disabledBtn) {
        this.disabledBtn = true;
        let n = 3;
        let time = setInterval(()=> {
          var str = '(' + n + ')' + '重新获取';
          this.authCodeText = str;
          if (n <= 0) {
            this.authCodeText = '重新获取';
            this.disabledBtn = false;
            clearInterval(time);
          }
          n--;
        }, 1000);
      }
    },

  

原文地址:https://www.cnblogs.com/hzx-5/p/12939468.html