Skip to content

Commit

Permalink
fix: login reload crush (#268)
Browse files Browse the repository at this point in the history
  • Loading branch information
uyarn authored Aug 11, 2022
1 parent dffcde1 commit 0c6ae6a
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 0c6ae6a

Please sign in to comment.