SOURCE

console 命令行工具 X clear

                    
>
console
var app = new Vue({
  el: '#app',
  data() {
    return {
       time:60,// 默认为60秒倒计时,可以输入修改
       get_code:'输入上方倒计时数字 -- 默认60',// 倒计时数字
    }
  }, 
  methods: {
    // 点击倒计时
    click_input(time){
        this.count_down(time)
    },
    // 倒计时
	count_down(time){
		// 开始倒计时
		var time_lang = time 
		this.get_code = '正在计时' + time + 's'
		var time_stop = setInterval(()=>{
			--time_lang
			if(time_lang > 0){ // 计时大于0
				this.get_code = '正在计时' + time_lang + 's'	
			}else{ // 倒计时小于0
				time_lang = time
                this.get_code = '倒计时结束'
				clearInterval(time_stop)
			}
		},1000)
	},
  }
});
<div id="app">
    <input type="num" v-model="time">
    <input type="button"  @click="click_input(time)" value="点击">
    <div>{{ get_code }}</div>
</div>

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