mounted(){ this.timer = setInterval(()=>{ this.init() },1000) this.$once(‘hook:beforeDestroy‘, ()=>{ clearInterval(this.timer) }) }
VUE--当前页面请求定时器,其他页面不需要
原文:https://www.cnblogs.com/wxy-developer/p/14836605.html