Przeglądaj źródła

fix: 修复前端Tag刷新无效的BUG

喵你个旺呀 1 rok temu
rodzic
commit
e475229e21
1 zmienionych plików z 6 dodań i 4 usunięć
  1. 6 4
      Web/src/layout/routerView/parent.vue

+ 6 - 4
Web/src/layout/routerView/parent.vue

@@ -21,6 +21,7 @@ import { useKeepALiveNames } from '/@/stores/keepAliveNames';
 import { useThemeConfig } from '/@/stores/themeConfig';
 import { Session } from '/@/utils/storage';
 import mittBus from '/@/utils/mitt';
+import {random} from "lodash-es";
 
 // 引入组件
 const Iframes = defineAsyncComponent(() => import('/@/layout/routerView/iframes.vue'));
@@ -69,10 +70,11 @@ onBeforeMount(() => {
 		state.refreshRouterViewKey = '';
 		state.iframeRefreshKey = '';
 		nextTick(() => {
-			state.refreshRouterViewKey = fullPath;
-			state.iframeRefreshKey = fullPath;
-			state.keepAliveNameList = keepAliveNames.value;
-		});
+      fullPath = (fullPath.indexOf('?') > 0 ? '&' : '?') + '_$t=' + Math.random();
+      state.refreshRouterViewKey = fullPath;
+      state.iframeRefreshKey = fullPath;
+      state.keepAliveNameList = keepAliveNames.value;
+    })
 	});
 });
 // 页面加载时