!144 修复keep-alive组件复用

Merge pull request !144 from NuroDante/dev
This commit is contained in:
奔跑的面条 2023-03-27 02:21:45 +00:00 committed by Gitee
commit 89d8134fad
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 10 additions and 4 deletions

View File

@ -2,12 +2,12 @@
<router-view>
<template #default="{ Component, route }">
<component
v-if="route.noKeepAlive"
v-if="route.meta.noKeepAlive"
:is="Component"
:key="route.fullPath"
></component>
<keep-alive v-else>
<component :is="Component" :key="route.fullPath"></component>
<component :is="Component" :key="route.meta?.key"></component>
</keep-alive>
</template>
</router-view>

View File

@ -46,4 +46,11 @@ const projectRoutes: RouteRecordRaw = {
]
}
projectRoutes.children?.forEach(child => {
child.meta = {
...child.meta,
key: 'reuse-project'
}
})
export default projectRoutes

View File

@ -45,8 +45,7 @@ const collapsed = ref<boolean>(false)
const { getAsideCollapsedWidth } = toRefs(useSettingStore())
const route = useRoute()
const routeRame = computed(() => route.name)
const menuValue = ref(routeRame)
const menuValue = computed(() => route.name)
const menuOptions = menuOptionsInit()