fix: Fix overview page refresh issue (#9785)

Refs #9756 #9769
This commit is contained in:
ssongliu 2025-08-01 10:47:22 +08:00 committed by GitHub
parent be0a460935
commit fba46be47a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 4 deletions

View file

@ -178,7 +178,7 @@ const changeNode = (command: string) => {
globalStore.currentNode = command || 'local'; globalStore.currentNode = command || 'local';
globalStore.currentNodeAddr = ''; globalStore.currentNodeAddr = '';
loadProductProFromDB(); loadProductProFromDB();
router.push({ name: 'home' }); router.push({ name: 'home', query: { t: Date.now() } });
return; return;
} }
for (const item of nodes.value) { for (const item of nodes.value) {
@ -198,7 +198,7 @@ const changeNode = (command: string) => {
globalStore.currentNode = command || 'local'; globalStore.currentNode = command || 'local';
globalStore.currentNodeAddr = item.addr; globalStore.currentNodeAddr = item.addr;
loadProductProFromDB(); loadProductProFromDB();
router.push({ name: 'home' }); router.push({ name: 'home', query: { t: Date.now() } });
} }
} }
}; };

View file

@ -1,5 +1,5 @@
<template> <template>
<div> <div :key="$route.fullPath">
<RouterButton <RouterButton
:buttons="[ :buttons="[
{ {
@ -339,6 +339,9 @@ const currentInfo = ref<Dashboard.CurrentInfo>({
memoryTotal: 0, memoryTotal: 0,
memoryAvailable: 0, memoryAvailable: 0,
memoryUsed: 0, memoryUsed: 0,
memoryFree: 0,
memoryShard: 0,
memoryCache: 0,
memoryUsedPercent: 0, memoryUsedPercent: 0,
swapMemoryTotal: 0, swapMemoryTotal: 0,
swapMemoryAvailable: 0, swapMemoryAvailable: 0,
@ -545,7 +548,7 @@ const toUpload = () => {
licenseRef.value.acceptParams(); licenseRef.value.acceptParams();
}; };
onMounted(() => { const fetchData = () => {
window.addEventListener('focus', onFocus); window.addEventListener('focus', onFocus);
window.addEventListener('blur', onBlur); window.addEventListener('blur', onBlur);
loadSafeStatus(); loadSafeStatus();
@ -553,6 +556,17 @@ onMounted(() => {
onLoadNetworkOptions(); onLoadNetworkOptions();
onLoadIOOptions(); onLoadIOOptions();
onLoadBaseInfo(true, 'all'); onLoadBaseInfo(true, 'all');
};
onBeforeRouteUpdate((to, from, next) => {
if (to.name === 'home') {
fetchData();
}
next();
});
onMounted(() => {
fetchData();
}); });
onBeforeUnmount(() => { onBeforeUnmount(() => {