interval(){
this.timer=setInterval(()=>{
console.log('执行定时器')
console.log(this.num);
this.num++;
if(某个条件下){
clearInterval(this.timer)
}
},3000)
},
},
created(){
this.interval()
}
beforeDestroy () {
console.log('清除定时器')
clearInterval(this.timer)
}