Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:Tencent/tdesign-vue-next-starter…
Browse files Browse the repository at this point in the history
… into main
  • Loading branch information
uyarn committed Aug 11, 2022
2 parents 5a825e1 + 0c6ae6a commit bff0245
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/layouts/components/Content.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,24 @@
<router-view v-if="!isRefreshing" v-slot="{ Component }">
<transition name="fade" mode="out-in">
<keep-alive :include="aliveViews">
<component :is="Component" :key="activeRouteFullPath" />
<component :is="Component" />
</keep-alive>
</transition>
</router-view>
</template>

<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;
});
// 如果存在需解决/page/1=> /page/2 刷新数据问题 请修改代码 使用activeRouteFullPath 作为key
// <component :is="Component" :key="activeRouteFullPath" />
// import { useRouter } from 'vue-router';
// const activeRouteFullPath = computed(() => {
// const router = useRouter();
// return router.currentRoute.value.fullPath;
// });
const aliveViews = computed(() => {
const tabsRouterStore = useTabsRouterStore();
Expand Down

0 comments on commit bff0245

Please sign in to comment.