diff --git a/src/layout/navBars/breadcrumb/breadcrumb.vue b/src/layout/navBars/breadcrumb/breadcrumb.vue index 8d022c7..8a33878 100644 --- a/src/layout/navBars/breadcrumb/breadcrumb.vue +++ b/src/layout/navBars/breadcrumb/breadcrumb.vue @@ -11,11 +11,11 @@ -
{{ $t(v.name) }}
-
{{ v.meta.tagsViewName }}
+
{{ $t(v.name.split("_")[0]) }}
+
{{ v.meta.tagsViewName.split("_")[0] }}
- {{ $t(v.name) }} + {{ $t(v.name.split('_')[0]) }}
diff --git a/src/layout/navBars/tagsView/tagsView.vue b/src/layout/navBars/tagsView/tagsView.vue index 9308817..1c712a5 100644 --- a/src/layout/navBars/tagsView/tagsView.vue +++ b/src/layout/navBars/tagsView/tagsView.vue @@ -388,7 +388,10 @@ const onMousedownMenu = (v: RouteItem, e: MouseEvent) => { }; // 当前的 tagsView 项点击时 const onTagsClick = (v: RouteItem, k: number) => { - state.tagsRefsIndex = k; + state.tagsRefsIndex = k; + if(v.name.indexOf("router.home")!=0){ + v.name=v.name.replaceAll("_","").replaceAll(v.id,"")+"_"+v.id + } router.push(v); }; // 处理 url,地址栏链接有参数时,tagsview 右键菜单刷新功能失效问题,感谢 @ZzZz-RIPPER、@dejavuuuuu diff --git a/src/layout/navMenu/horizontal.vue b/src/layout/navMenu/horizontal.vue index 92ccdbe..b3e147f 100644 --- a/src/layout/navMenu/horizontal.vue +++ b/src/layout/navMenu/horizontal.vue @@ -7,7 +7,7 @@ @@ -16,12 +16,12 @@ diff --git a/src/layout/navMenu/subItem.vue b/src/layout/navMenu/subItem.vue index 45a173c..e782035 100644 --- a/src/layout/navMenu/subItem.vue +++ b/src/layout/navMenu/subItem.vue @@ -3,7 +3,8 @@ @@ -11,12 +12,14 @@ + + {{ $t(val.name.split('_')[0]) }} + diff --git a/src/layout/navMenu/vertical.vue b/src/layout/navMenu/vertical.vue index b76c17b..5561557 100644 --- a/src/layout/navMenu/vertical.vue +++ b/src/layout/navMenu/vertical.vue @@ -12,7 +12,7 @@ @@ -21,10 +21,10 @@ diff --git a/src/router/index.ts b/src/router/index.ts index a7bcf4b..7111cb6 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -66,6 +66,9 @@ export function formatTwoStageRoutes(arr: any) { if (v.path === '/') { newArr.push({ component: v.component, name: v.name, path: v.path, redirect: v.redirect, meta: v.meta, children: [] }); } else { + if (v.id) { + v.name=v.name+"_"+v.id; + } // 判断是否是动态路由(xx/:id/:name),用于 tagsView 等中使用 if (v.path.indexOf('/:') > -1) { v.meta['isDynamic'] = true; diff --git a/src/utils/other.ts b/src/utils/other.ts index 0705a6a..d1befa9 100644 --- a/src/utils/other.ts +++ b/src/utils/other.ts @@ -47,8 +47,14 @@ export function setTagsViewNameI18n(item: any) { tagsViewName = query?.tagsViewName || params?.tagsViewName; } } else { + let name='' + if (item.name.indexOf("_") >= 0) { + name=item.name.split("_")[0] + }else{ + name=item.name + } // 非自定义 tagsView 名称 - tagsViewName = i18n.global.t(item.name); + tagsViewName = i18n.global.t(name); } return tagsViewName; }