fix: 调整加载个人信息逻辑

This commit is contained in:
2025-02-23 03:55:09 +08:00
parent 3f50400915
commit 79797b6ffc
4 changed files with 26 additions and 9 deletions

View File

@@ -121,6 +121,7 @@ import * as echarts from "echarts";
import Monitor from "@iconify-icons/ep/monitor";
import PieChart from "@iconify-icons/ep/pie-chart";
import Odometer from "@iconify-icons/ep/odometer";
import { onBeforeRouteLeave } from "vue-router";
const cache = reactive({
commandStats: [] as { name: string; value: number }[],
@@ -240,13 +241,18 @@ const initUsedMemoryChart = () => {
chart.setOption(option);
};
/**定时ID */
const timer = ref();
onMounted(async () => {
await getCacheInfo();
setInterval(() => {
timer.value = setInterval(() => {
getCacheInfo();
}, 60000);
});
/**页面离开时清除定时器 */
onBeforeRouteLeave(() => {
clearInterval(timer.value);
});
</script>
<style scoped lang="scss">