From 8725a0130154498d30806b6621252bb97f807d26 Mon Sep 17 00:00:00 2001 From: Vben Date: Sat, 10 Aug 2024 10:30:15 +0800 Subject: [PATCH] fix: inconsistent performance between breadcrumbs and tabs (#4105) --- .github/release-drafter.yml | 9 +++++++-- docs/.vitepress/theme/plugins/hm.ts | 2 +- .../breadcrumb/breadcrumb-background.vue | 3 ++- .../src/components/breadcrumb/breadcrumb.vue | 9 ++++++--- .../effects/layouts/src/basic/tabbar/use-tabbar.ts | 14 +++++++++----- 5 files changed, 25 insertions(+), 12 deletions(-) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 03374c1d..6fef16be 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -17,11 +17,12 @@ categories: - title: "🐞 Bug Fixes" labels: - "bug" - - title: 📝 Documentation updates + - title: 📝 Documentation labels: - "documentation" - title: 👻 Maintenance labels: + - "perf" - "chore" - "dependencies" collapse-after: 5 @@ -34,12 +35,16 @@ categories: version-resolver: major: labels: + - "major" - "breaking" minor: labels: - - "feature" + - "minor" + # - "feature" patch: labels: + - "patch" + - "feature" - "bug" - "maintenance" - "docs" diff --git a/docs/.vitepress/theme/plugins/hm.ts b/docs/.vitepress/theme/plugins/hm.ts index a13072de..5e0a9318 100644 --- a/docs/.vitepress/theme/plugins/hm.ts +++ b/docs/.vitepress/theme/plugins/hm.ts @@ -23,6 +23,6 @@ function registerAnalytics() { export function initHmPlugin() { if (inBrowser && import.meta.env.PROD) { - registerAnalytics(SITE_ID); + registerAnalytics(); } } diff --git a/packages/@core/ui-kit/shadcn-ui/src/components/breadcrumb/breadcrumb-background.vue b/packages/@core/ui-kit/shadcn-ui/src/components/breadcrumb/breadcrumb-background.vue index e273e471..f27ab442 100644 --- a/packages/@core/ui-kit/shadcn-ui/src/components/breadcrumb/breadcrumb-background.vue +++ b/packages/@core/ui-kit/shadcn-ui/src/components/breadcrumb/breadcrumb-background.vue @@ -33,7 +33,8 @@ function handleClick(path?: string) { diff --git a/packages/@core/ui-kit/shadcn-ui/src/components/breadcrumb/breadcrumb.vue b/packages/@core/ui-kit/shadcn-ui/src/components/breadcrumb/breadcrumb.vue index 0cf1a3e8..6b316414 100644 --- a/packages/@core/ui-kit/shadcn-ui/src/components/breadcrumb/breadcrumb.vue +++ b/packages/@core/ui-kit/shadcn-ui/src/components/breadcrumb/breadcrumb.vue @@ -51,7 +51,8 @@ function handleClick(path?: string) { @@ -77,8 +78,9 @@ function handleClick(path?: string) { >
@@ -88,8 +90,9 @@ function handleClick(path?: string) {
diff --git a/packages/effects/layouts/src/basic/tabbar/use-tabbar.ts b/packages/effects/layouts/src/basic/tabbar/use-tabbar.ts index 297ca7c3..c27380dd 100644 --- a/packages/effects/layouts/src/basic/tabbar/use-tabbar.ts +++ b/packages/effects/layouts/src/basic/tabbar/use-tabbar.ts @@ -1,9 +1,6 @@ import type { TabDefinition } from '@vben/types'; import type { IContextMenuItem } from '@vben-core/tabs-ui'; -import type { - RouteLocationNormalized, - RouteLocationNormalizedGeneric, -} from 'vue-router'; +import type { RouteLocationNormalizedGeneric } from 'vue-router'; import { computed, ref, watch } from 'vue'; import { useRoute, useRouter } from 'vue-router'; @@ -103,7 +100,14 @@ export function useTabbar() { watch( () => route.path, () => { - tabbarStore.addTab(route as RouteLocationNormalized); + // 这里不能用route,用route时,vue-router会自动将父级meta进行合并 + const routes = router.getRoutes(); + const currentRoute = routes.find((item) => item.path === route.path); + if (currentRoute) { + tabbarStore.addTab( + currentRoute as unknown as RouteLocationNormalizedGeneric, + ); + } }, { immediate: true }, );