diff --git a/arco-design-pro-vite/src/components/menu/index.vue b/arco-design-pro-vite/src/components/menu/index.vue index ce5840d..b429a7d 100644 --- a/arco-design-pro-vite/src/components/menu/index.vue +++ b/arco-design-pro-vite/src/components/menu/index.vue @@ -86,7 +86,8 @@ }; listenerRouteChange((newRoute) => { if (newRoute.meta.requiresAuth && !newRoute.meta.hideInMenu) { - const key = newRoute.matched[2]?.name as string; + const key = newRoute.matched[newRoute.matched.length - 1] + ?.name as string; selectedKey.value = [key]; } }, true); @@ -101,25 +102,26 @@ _route.forEach((element) => { // This is demo, modify nodes as needed const icon = element?.meta?.icon - ? `<${element?.meta?.icon}/>` - : ``; - const r = ( + ? () => h(compile(`<${element?.meta?.icon}/>`)) + : null; + const r = element?.children ? ( h(compile(icon)), + icon, title: () => h(compile(t(element?.meta?.locale || ''))), }} > - {element?.children?.map((elem) => { - return ( - goto(elem)}> - {t(elem?.meta?.locale || '')} - {travel(elem.children ?? [])} - - ); - })} + {travel(element?.children)} + ) : ( + goto(element)} + > + {t(element?.meta?.locale || '')} + ); nodes.push(r as never); }); @@ -128,6 +130,7 @@ } return travel(menuTree.value); }; + return () => ( - - + + + + + + diff --git a/arco-design-pro-vite/src/store/modules/tab-bar/index.ts b/arco-design-pro-vite/src/store/modules/tab-bar/index.ts index 798de10..74c1f2d 100644 --- a/arco-design-pro-vite/src/store/modules/tab-bar/index.ts +++ b/arco-design-pro-vite/src/store/modules/tab-bar/index.ts @@ -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', }, ], @@ -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);