Skip to content

Commit

Permalink
fix: 修复问题(un-pany#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
HavocZhang committed Aug 23, 2023
1 parent bf165a5 commit 0b75577
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions src/layouts/components/AppMain.vue
Original file line number Diff line number Diff line change
@@ -1,33 +1,24 @@
<script lang="ts" setup>
import { computed } from "vue"
import { useRoute } from "vue-router"
import { useTagsViewStore } from "@/store/modules/tags-view"
const route = useRoute()
const tagsViewStore = useTagsViewStore()
const key = computed(() => {
// 返回 route.path 和 route.fullPath 有着不同的效果,大多数时候 path 更通用
return route.path
})
</script>

<template>
<section class="app-main">
<div class="app-main">
<div class="app-scrollbar">
<router-view v-slot="{ Component }">
<transition name="el-fade-in" mode="out-in">
<keep-alive :include="tagsViewStore.cachedViews">
<component :is="Component" :key="key" />
</keep-alive>
</transition>
<router-view v-slot="{ Component, route }">
<keep-alive :include="tagsViewStore.cachedViews">
<transition name="el-fade-in" mode="out-in">
<component :is="Component" :key="route.fullPath" />
</transition>
</keep-alive>
</router-view>
</div>
<!-- 返回顶部 -->
<el-backtop />
<!-- 返回顶部(固定 Header 情况下) -->
<el-backtop target=".app-scrollbar" />
</section>
</div>
</template>

<style lang="scss" scoped>
Expand Down

0 comments on commit 0b75577

Please sign in to comment.