export default {
  data() {
    return {
      disabled: false,
      text: this.$t('common.verificationcodetip')
    };
  },
  methods: {
    sendCode() {
      if (this.disabled) return;
      this.disabled = true;
      let n = 60;
      this.text = this.$t('common.verificationcodetip1').replace('%d',n+'');
      const run = setInterval(() => {
        n = n - 1;
        if (n < 0) {
          clearInterval(run);
        }
         this.text = this.$t('common.verificationcodetip1').replace('%d',n+'');
        if (n < 0) {
          this.disabled = false;
          this.text = this.$t('common.verificationcodetip3');
        }
      }, 1000);
    }
  }
};