Merge branch 'develop' of github.com:Tencent/tdesign-vue-next-starter into main

This commit is contained in:
Uyarn 2022-08-11 15:54:13 +08:00
commit bff024568b

View File

@ -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" :key="activeRouteFullPath" /> <component :is="Component" />
</keep-alive> </keep-alive>
</transition> </transition>
</router-view> </router-view>
@ -10,13 +10,16 @@
<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(() => { // /page/1=> /page/2 使activeRouteFullPath key
const router = useRouter(); // <component :is="Component" :key="activeRouteFullPath" />
return router.currentRoute.value.fullPath;
}); // import { useRouter } from 'vue-router';
// const activeRouteFullPath = computed(() => {
// const router = useRouter();
// return router.currentRoute.value.fullPath;
// });
const aliveViews = computed(() => { const aliveViews = computed(() => {
const tabsRouterStore = useTabsRouterStore(); const tabsRouterStore = useTabsRouterStore();