能量管理:清除定时器

This commit is contained in:
高云鹏 2025-01-22 16:04:54 +08:00
parent ac790b72a8
commit db9e6efc68

View File

@ -869,6 +869,7 @@ const resizeFn = () => {
const stopAutoUpdate = () => {
timer && clearInterval(timer)
timer = null
}
const realDataListSetValue = reactive({
@ -919,6 +920,10 @@ const autoUpdateList = () => {
}, 2000)
}
}
const clearListTimer = () => {
listTimer && clearInterval(listTimer)
listTimer = null
}
onMounted(() => {
getContainerHeight()
autoUpdateList()
@ -928,6 +933,7 @@ onMounted(() => {
onUnmounted(() => {
window.removeEventListener('resize', resizeFn)
stopAutoUpdate()
clearListTimer()
})
</script>