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

View file

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