Commit 520244ee by cherishsince

【增加】Image 列表组件取消挂在 销毁定时刷

parent c96f3cea
......@@ -87,9 +87,10 @@ const downloadImage = async (imageUrl) => {
}
}
//
/** 暴露组件方法 */
defineExpose({getImageList})
//
/** 组件挂在的时候 */
onMounted(async () => {
// 获取 image 列表
await getImageList()
......@@ -98,9 +99,12 @@ onMounted(async () => {
await getImageList()
}, 1000 * 20)
})
//
onUnmounted(async () => {
/** 组件取消挂在的时候 */
onUnmounted(async () => {
if (imageListInterval.value) {
clearInterval(imageListInterval.value)
}
})
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment