<template>
              <el-col :span="10" class="getCode">
                <el-button
                  :disabled="isDisabled"
                  :class="isDisabled?'lightBrown opacity':'deepBrown'"
                  @click="getCode"
                >{{buttonName}}</el-button>
              </el-col>
</template>

<script>
//自己定义data哈
getCode(){
            let that = this;
            that.isDisabled = true;
            let interval = window.setInterval(function() {
              that.buttonName = "(" + that.second + "秒)后重新发送";
              --that.second;
              if (that.second < 0) {
                that.buttonName = "重新发送";
                that.second = 60;
                that.isDisabled = false;
                window.clearInterval(interval);
              }
            }, 1000);
}
</script>

 

Logo

前往低代码交流专区

更多推荐