mirror of
https://github.com/Tencent/tdesign-vue-next-starter.git
synced 2024-11-10 13:28:32 +08:00
feat: 添加组件key (#251)
This commit is contained in:
parent
86eb38220d
commit
05d49fd2cf
|
@ -2,7 +2,7 @@
|
|||
<router-view v-if="!isRefreshing" v-slot="{ Component }">
|
||||
<transition name="fade" mode="out-in">
|
||||
<keep-alive :include="aliveViews">
|
||||
<component :is="Component" />
|
||||
<component :is="Component" :key="activeRouteFullPath" />
|
||||
</keep-alive>
|
||||
</transition>
|
||||
</router-view>
|
||||
|
@ -10,8 +10,14 @@
|
|||
|
||||
<script setup lang="ts">
|
||||
import { computed, ComputedRef } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useTabsRouterStore } from '@/store';
|
||||
|
||||
const activeRouteFullPath = computed(() => {
|
||||
const router = useRouter();
|
||||
return router.currentRoute.value.fullPath;
|
||||
});
|
||||
|
||||
const aliveViews = computed(() => {
|
||||
const tabsRouterStore = useTabsRouterStore();
|
||||
const { tabRouters } = tabsRouterStore;
|
||||
|
|
Loading…
Reference in New Issue
Block a user