代码如下,跳转页面后定时器依然在执行
created(){ this.interval() }, beforeDestroy () { console.log('清除定时器') clearInterval(this.interval) }, methods: { interval(){ setInterval(()=>{ console.log('执行定时器') this.loadList() },3000) }, }
慕标5832272
相关分类