Skip to content

Commit 520244e

Browse files
committed
【增加】Image 列表组件取消挂在 销毁定时刷
1 parent c96f3ce commit 520244e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/views/ai/image/ImageTask.vue

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,10 @@ const downloadImage = async (imageUrl) => {
8787
}
8888
}
8989
90-
//
90+
/** 暴露组件方法 */
9191
defineExpose({getImageList})
92-
//
92+
93+
/** 组件挂在的时候 */
9394
onMounted(async () => {
9495
// 获取 image 列表
9596
await getImageList()
@@ -98,9 +99,12 @@ onMounted(async () => {
9899
await getImageList()
99100
}, 1000 * 20)
100101
})
101-
//
102-
onUnmounted(async () => {
103102
103+
/** 组件取消挂在的时候 */
104+
onUnmounted(async () => {
105+
if (imageListInterval.value) {
106+
clearInterval(imageListInterval.value)
107+
}
104108
})
105109
</script>
106110

0 commit comments

Comments
 (0)