let timer = setInterval(() => {
this.$store.commit('set_cycleCount')
}, 1000)
this.$once('hook:beforeDestroy', () => {
clearInterval(timer)
timer = null
})
销毁定时器
最新推荐文章于 2024-05-07 15:50:55 发布
let timer = setInterval(() => {
this.$store.commit('set_cycleCount')
}, 1000)
this.$once('hook:beforeDestroy', () => {
clearInterval(timer)
timer = null
})