fix: 修复组件缓存问题

This commit is contained in:
Nuro 2023-03-21 20:18:41 +08:00
parent 0f93b0285b
commit 2cbb851948
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()