diff --git a/src/layout/components/header/components/topBar/components/left.vue b/src/layout/components/header/components/topBar/components/left.vue index 309139fb..c197db02 100644 --- a/src/layout/components/header/components/topBar/components/left.vue +++ b/src/layout/components/header/components/topBar/components/left.vue @@ -37,7 +37,11 @@ const setBreadcrumbList = (route: RouteLocationNormalized) => { let temp = { children: routes.value } as unknown as RouteRecordRaw; route.meta.menuIndex!.forEach((item) => { temp = temp.children![item]; - if (temp.meta && temp.meta.title && temp.meta.breadcrumb !== false) { + if ( + temp.meta?.title && + temp.meta.breadcrumb !== false && + (temp.meta.breadcrumb || temp.children?.filter((v) => v.meta?.breadcrumb !== false).length !== 1) + ) { list.push({ name: temp.name, path: temp.path, diff --git a/types/auto-imports.d.ts b/types/auto-imports.d.ts index 1071a503..1d06c04e 100644 --- a/types/auto-imports.d.ts +++ b/types/auto-imports.d.ts @@ -3,6 +3,7 @@ export {} declare global { const EffectScope: typeof import('vue')['EffectScope'] const ElLoading: typeof import('element-plus/es')['ElLoading'] + const ElMessageBox: typeof import('element-plus/es')['ElMessageBox'] const acceptHMRUpdate: typeof import('pinia')['acceptHMRUpdate'] const asyncComputed: typeof import('@vueuse/core')['asyncComputed'] const autoResetRef: typeof import('@vueuse/core')['autoResetRef'] diff --git a/types/vue-router.d.ts b/types/vue-router.d.ts index 17457542..da81fbee 100644 --- a/types/vue-router.d.ts +++ b/types/vue-router.d.ts @@ -26,7 +26,7 @@ declare module 'vue-router' { // 若你想不管路由下面的 children 声明的个数都显示你的根路由 // 你可以设置 alwaysShow: true,这样它就会忽略之前定义的规则,一直显示根路由 alwaysShow?: boolean; - // 是否需要面包屑false不需要 ture或undefined为需要 + // 是否需要面包屑 false不展示在面包屑,ture一直展示在面包屑,undefined当只有一个子元素面包屑时跳过展示 breadcrumb?: boolean; //路由在菜单的index deep映射(会动态计算不要设置默认值) menuIndex?: number[];