Skip to content

Commit

Permalink
fix: router-view nest
Browse files Browse the repository at this point in the history
  • Loading branch information
hehehai committed Apr 20, 2022
1 parent fcdc9c0 commit 8c3d786
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 18 deletions.
2 changes: 1 addition & 1 deletion arco-design-pro-vite/src/components/menu/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
// This is demo, modify nodes as needed
const icon = element?.meta?.icon
? () => h(compile(`<${element?.meta?.icon}/>`))
: undefined;
: null;
const r = element?.children ? (
<a-sub-menu
key={element?.name}
Expand Down
21 changes: 6 additions & 15 deletions arco-design-pro-vite/src/layout/page-layout.vue
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
<template>
<router-view>
<template #default="{ Component: ParentComponent }">
<router-view v-slot="{ Component = ParentComponent, route }">
<transition name="fade" mode="out-in" appear>
<component
:is="Component"
v-if="route.meta.ignoreCache"
:key="route.fullPath"
/>
<keep-alive v-else :include="cacheList">
<component :is="Component" :key="route.fullPath" />
</keep-alive>
</transition>
</router-view>
</template>
<router-view v-slot="{ Component, route }">
<transition name="fade" mode="out-in" appear>
<keep-alive :include="cacheList">
<component :is="Component" :key="route.fullPath" />
</keep-alive>
</transition>
</router-view>
</template>

Expand Down
6 changes: 4 additions & 2 deletions arco-design-pro-vite/src/store/modules/tab-bar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const useAppStore = defineStore('tabBar', {
// Set the first element dynamically as needed
{
title: 'menu.dashboard.workplace',
name: 'workplace',
name: 'Workplace',
fullPath: '/dashboard/workplace',
},
],
Expand All @@ -37,7 +37,9 @@ const useAppStore = defineStore('tabBar', {
actions: {
updateTabList(route: RouteLocationNormalized) {
this.tagList.push(formatTag(route));
this.cacheTabList.add(route.name as string);
if (!route.meta.ignoreCache) {
this.cacheTabList.add(route.name as string);
}
},
deleteTag(idx: number, tag: TagProps) {
this.tagList.splice(idx, 1);
Expand Down

0 comments on commit 8c3d786

Please sign in to comment.