SOURCE

console 命令行工具 X clear

                    
>
console
var timer;
var app = new Vue({
  el: '#app',
  data() {
    return {
        time:59
    }
    
  }, 
  methods: {
    // 开始倒计时
    start(){
        if(this.time > 0){
        timer = setInterval(this.dec,100);
        }
    },
    dec(){
        if(this.time > 0){
            this.time--
        var length = this.time.toString().length
        if (length == 1){
            this.time = '0'+this.time
        }
        }else{
         clearInterval(timer)   
        }
        console.log(this.time)
    },
    // 结束倒计时
    end(){
        clearInterval(timer)
    },
    // 重置
    reset(){
        this.time = 59
    }

  }
  
});
<div id="app">
    当前时间:00:{{time}}
    <br>
    <br>
    <button @click="start">开始计时</button>
    <button @click="end">停止计时</button>
    <button @click="reset">刷新</button>
</div>
img{
    width: 20%;
}

本项目引用的自定义外部资源