mirror of
https://github.com/MCSManager/MCSManager.git
synced 2024-12-21 07:49:08 +08:00
Fix: clear Interval
This commit is contained in:
parent
8b2e658340
commit
544bebad96
@ -16,6 +16,7 @@ import { useFileManager } from "@/hooks/useFileManager";
|
||||
import FileEditor from "./dialogs/FileEditor.vue";
|
||||
import type { DataType } from "@/types/fileManager";
|
||||
import type { AntColumnsType } from "@/types/ant";
|
||||
import { onUnmounted } from "vue";
|
||||
|
||||
const props = defineProps<{
|
||||
card: LayoutCard;
|
||||
@ -133,7 +134,8 @@ watch(
|
||||
}, 1000)
|
||||
);
|
||||
|
||||
setInterval(async () => {
|
||||
let task: NodeJS.Timer | undefined;
|
||||
task = setInterval(async () => {
|
||||
await getFileStatus();
|
||||
}, 3000);
|
||||
|
||||
@ -150,6 +152,11 @@ onMounted(() => {
|
||||
getFileList();
|
||||
dialog.value.loading = false;
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
if (task) clearInterval(task);
|
||||
task = undefined;
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
Loading…
Reference in New Issue
Block a user