发送验证码 倒计时

  countdown(seconds) {
      if (seconds < 0) {
        this.openCountdown = true;
        return;
      }
      this.seconds = seconds;
      setTimeout(() => {
        this.countdown(seconds - 1);
      }, 1000);
    },

调用 this.countdown(60);   展示{{seconds}}

你可能感兴趣的:(javascript)