Skip to content

Commit e379d6c

Browse files
committed
fix(projects): fix multi tab page only render once. fixed #441
1 parent 64fc099 commit e379d6c

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/layouts/modules/global-content/index.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { computed } from 'vue';
33
import { useAppStore } from '@/store/modules/app';
44
import { useThemeStore } from '@/store/modules/theme';
55
import { useRouteStore } from '@/store/modules/route';
6+
import { useTabStore } from '@/store/modules/tab';
67
78
defineOptions({
89
name: 'GlobalContent'
@@ -20,6 +21,7 @@ withDefaults(defineProps<Props>(), {
2021
const appStore = useAppStore();
2122
const themeStore = useThemeStore();
2223
const routeStore = useRouteStore();
24+
const tabStore = useTabStore();
2325
2426
const transitionName = computed(() => (themeStore.page.animate ? themeStore.page.animateMode : ''));
2527
</script>
@@ -36,7 +38,7 @@ const transitionName = computed(() => (themeStore.page.animate ? themeStore.page
3638
<component
3739
:is="Component"
3840
v-if="appStore.reloadFlag"
39-
:key="route.path"
41+
:key="tabStore.getTabIdByRoute(route)"
4042
:class="{ 'p-16px': showPadding }"
4143
class="flex-grow bg-layout transition-300"
4244
/>

src/store/modules/tab/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
getDefaultHomeTab,
1818
getFixedTabIds,
1919
getTabByRoute,
20+
getTabIdByRoute,
2021
isTabInTabs,
2122
updateTabByI18nKey,
2223
updateTabsByI18nKey
@@ -288,6 +289,7 @@ export const useTabStore = defineStore(SetupStoreId.Tab, () => {
288289
setTabLabel,
289290
resetTabLabel,
290291
isTabRetain,
291-
updateTabsByLocale
292+
updateTabsByLocale,
293+
getTabIdByRoute
292294
};
293295
});

0 commit comments

Comments
 (0)