vue按钮10S秒后禁用

1、

批量验证买号降权

       

        ({{setTimeNum}}s)

2、data

         abledBut: false, //是否禁止

      setTimeNum: 10,  // 倒计时时间

      timeWrap: null,  // 定时器标识

3.、监听定时器

watch: {

    setTimeNum (newVal, oldVal) {

      if (newVal < 0) {

        clearInterval(this.timeWrap)

        this.abledBut = false

        this.setTimeNum = 10

      }

    }

  },

4、

 async  batchVerify () {

      const { msg } = await getVerify()

      this.$message({

        type: 'success',

        message: '操作成功'

      })

      if (this.setTimeNum > 0) {

        this.abledBut = true

        this.timeWrap = setInterval(() => {

          this.setTimeNum -= 1

        }, 1000)

      }

    },

5完成点赞  日常模板  

你可能感兴趣的:(vue.js,elementui,javascript)