SOURCE

console 命令行工具 X clear

                    
>
console
new Vue({
  el: '#app',
  data: {
    message: 'Hello MVVM',
    buttonMsg: '点击开始倒计时',
    buttonDisable: false,
    countTime: 3
  },
  methods: {
  	countDown () {
    	this.buttonMsg = this.countTime + 's后可以重新点击'
      this.buttonDisable = true
 			var clock = window.setInterval(() => {
  			this.countTime--
  			this.buttonMsg = this.countTime + 's后可以重新点击'
  			if (this.countTime < 1) {
   				window.clearInterval(clock)
    			this.buttonMsg = '点击开始倒计时'
          this.buttonDisable = false
    			this.countTime = 3
    		}
 			},1000)
    }
  }
})
<script src="https://unpkg.com/vue"></script>

<div id="app">
  <p>{{ message }}</p>
  <button 
    @click="countDown"
    :class="{ button_disable: buttonDisable }"
    :disabled="buttonDisable">
    {{ buttonMsg }}
  </button>
</div>
button {
  width: 150px;
  border: none;
  background-color: #2795F7;
  color: #fff;
  padding: 10px 0;
  outline: none;
  transition: 0.5s;
}

button.button_disable {
  background-color: #E7EAED;
  color: #333;
}