mirror of
https://github.com/MCSManager/MCSManager.git
synced 2024-12-27 07:59: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 FileEditor from "./dialogs/FileEditor.vue";
|
||||||
import type { DataType } from "@/types/fileManager";
|
import type { DataType } from "@/types/fileManager";
|
||||||
import type { AntColumnsType } from "@/types/ant";
|
import type { AntColumnsType } from "@/types/ant";
|
||||||
|
import { onUnmounted } from "vue";
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
card: LayoutCard;
|
card: LayoutCard;
|
||||||
@ -133,7 +134,8 @@ watch(
|
|||||||
}, 1000)
|
}, 1000)
|
||||||
);
|
);
|
||||||
|
|
||||||
setInterval(async () => {
|
let task: NodeJS.Timer | undefined;
|
||||||
|
task = setInterval(async () => {
|
||||||
await getFileStatus();
|
await getFileStatus();
|
||||||
}, 3000);
|
}, 3000);
|
||||||
|
|
||||||
@ -150,6 +152,11 @@ onMounted(() => {
|
|||||||
getFileList();
|
getFileList();
|
||||||
dialog.value.loading = false;
|
dialog.value.loading = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
if (task) clearInterval(task);
|
||||||
|
task = undefined;
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
Loading…
Reference in New Issue
Block a user