mounted(){
const timer = setInterval(()=>{
console.log(1)
},500)
this.$once('hook:beforeDestory',()=>clearInterval(timer))
}
vue组件销毁时清除定时器
最新推荐文章于 2024-06-11 07:57:19 发布
mounted(){
const timer = setInterval(()=>{
console.log(1)
},500)
this.$once('hook:beforeDestory',()=>clearInterval(timer))
}