fix dashboard

This commit is contained in:
jxxghp
2023-07-11 09:07:40 +08:00
parent de30dc6ce1
commit f8f59f929f
3 changed files with 39 additions and 5 deletions
@@ -5,6 +5,9 @@ import { ScheduleInfo } from "@/api/types";
// 定时服务列表
const schedulerList = ref<ScheduleInfo[]>([]);
// 定时器
let refreshTimer: NodeJS.Timer | null = null;
// 调用API加载定时服务列表
const loadSchedulerList = async () => {
try {
@@ -17,6 +20,18 @@ const loadSchedulerList = async () => {
onMounted(() => {
loadSchedulerList();
// 启动定时器
refreshTimer = setInterval(() => {
loadSchedulerList();
}, 60000);
});
// 组件卸载时停止定时器
onUnmounted(() => {
if (refreshTimer) {
clearInterval(refreshTimer);
refreshTimer = null;
}
});
</script>