export default {
data() {
return {
min: 1,
max: 10,
timer:null //定時器名稱
}
},
mounted() {
this.add();
},
methods: {
add() {
let _this = this;
_this.timer = setInterval(function(){//定時器開始
_this.min++;
if(_this.min == _this.max){
clearInterval(_this.timer);// 滿足條件時 停止計時
}
},1000)
},
}
};