能量管理:清除定时器
This commit is contained in:
parent
ac790b72a8
commit
db9e6efc68
@ -869,6 +869,7 @@ const resizeFn = () => {
|
|||||||
const stopAutoUpdate = () => {
|
const stopAutoUpdate = () => {
|
||||||
timer && clearInterval(timer)
|
timer && clearInterval(timer)
|
||||||
timer = null
|
timer = null
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const realDataListSetValue = reactive({
|
const realDataListSetValue = reactive({
|
||||||
@ -919,6 +920,10 @@ const autoUpdateList = () => {
|
|||||||
}, 2000)
|
}, 2000)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const clearListTimer = () => {
|
||||||
|
listTimer && clearInterval(listTimer)
|
||||||
|
listTimer = null
|
||||||
|
}
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getContainerHeight()
|
getContainerHeight()
|
||||||
autoUpdateList()
|
autoUpdateList()
|
||||||
@ -928,6 +933,7 @@ onMounted(() => {
|
|||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
window.removeEventListener('resize', resizeFn)
|
window.removeEventListener('resize', resizeFn)
|
||||||
stopAutoUpdate()
|
stopAutoUpdate()
|
||||||
|
clearListTimer()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user