能量管理:清除定时器

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 = () => { 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>