fix: 调整加载个人信息逻辑
This commit is contained in:
10
src/views/monitor/cache/index.vue
vendored
10
src/views/monitor/cache/index.vue
vendored
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user