mirror of
https://github.com/Tencent/tdesign-vue-next-starter.git
synced 2024-11-10 13:01:14 +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 }">
|
<router-view v-if="!isRefreshing" v-slot="{ Component }">
|
||||||
<transition name="fade" mode="out-in">
|
<transition name="fade" mode="out-in">
|
||||||
<keep-alive :include="aliveViews">
|
<keep-alive :include="aliveViews">
|
||||||
<component :is="Component" />
|
<component :is="Component" :key="activeRouteFullPath" />
|
||||||
</keep-alive>
|
</keep-alive>
|
||||||
</transition>
|
</transition>
|
||||||
</router-view>
|
</router-view>
|
||||||
|
@ -10,8 +10,14 @@
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ComputedRef } from 'vue';
|
import { computed, ComputedRef } from 'vue';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
import { useTabsRouterStore } from '@/store';
|
import { useTabsRouterStore } from '@/store';
|
||||||
|
|
||||||
|
const activeRouteFullPath = computed(() => {
|
||||||
|
const router = useRouter();
|
||||||
|
return router.currentRoute.value.fullPath;
|
||||||
|
});
|
||||||
|
|
||||||
const aliveViews = computed(() => {
|
const aliveViews = computed(() => {
|
||||||
const tabsRouterStore = useTabsRouterStore();
|
const tabsRouterStore = useTabsRouterStore();
|
||||||
const { tabRouters } = tabsRouterStore;
|
const { tabRouters } = tabsRouterStore;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user