vue 是单页面应用,路由切换后,定时器并不会自动关闭,需要手动清除,当页面被销毁时,清除定时器即可。
mounted(){
clearInterval(this.timer);
this.setTimer();
},
destroyed(){
clearInterval(this.timer)
}
vue 是单页面应用,路由切换后,定时器并不会自动关闭,需要手动清除,当页面被销毁时,清除定时器即可。
mounted(){
clearInterval(this.timer);
this.setTimer();
},
destroyed(){
clearInterval(this.timer)
}