Forráskód Böngészése

fix: inconsistent performance between breadcrumbs and tabs (#4105)

Vben 7 hónapja
szülő
commit
8725a01301

+ 7 - 2
.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"

+ 1 - 1
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();
   }
 }

+ 2 - 1
packages/@core/ui-kit/shadcn-ui/src/components/breadcrumb/breadcrumb-background.vue

@@ -33,7 +33,8 @@ function handleClick(path?: string) {
           <a href="javascript:void 0" @click.stop="handleClick(item.path)">
             <span class="flex-center z-10 h-full">
               <VbenIcon
-                v-if="item.icon && showIcon"
+                v-if="showIcon"
+                :fallback="showIcon"
                 :icon="item.icon"
                 class="mr-1 size-4 flex-shrink-0"
               />

+ 6 - 3
packages/@core/ui-kit/shadcn-ui/src/components/breadcrumb/breadcrumb.vue

@@ -51,7 +51,8 @@ function handleClick(path?: string) {
               <DropdownMenu>
                 <DropdownMenuTrigger class="flex items-center gap-1">
                   <VbenIcon
-                    v-if="item.icon && showIcon"
+                    v-if="showIcon"
+                    :fallback="showIcon"
                     :icon="item.icon"
                     class="size-5"
                   />
@@ -77,8 +78,9 @@ function handleClick(path?: string) {
             >
               <div class="flex-center">
                 <VbenIcon
-                  v-if="item.icon && showIcon"
+                  v-if="showIcon"
                   :class="{ 'size-5': item.isHome }"
+                  :fallback="showIcon"
                   :icon="item.icon"
                   class="mr-1 size-4"
                 />
@@ -88,8 +90,9 @@ function handleClick(path?: string) {
             <BreadcrumbPage v-else>
               <div class="flex-center">
                 <VbenIcon
-                  v-if="item.icon && showIcon"
+                  v-if="showIcon"
                   :class="{ 'size-5': item.isHome }"
+                  :fallback="showIcon"
                   :icon="item.icon"
                   class="mr-1 size-4"
                 />

+ 9 - 5
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 },
   );