mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 09:09:20 +08:00
feat: 菜单侧栏标题与标签标题拆分并支持 tab_title 回退
This commit is contained in:
@@ -118,9 +118,17 @@ interface RouteMeta {
|
||||
*/
|
||||
query?: Recordable;
|
||||
/**
|
||||
* 标题名称
|
||||
* 标题名称(侧栏菜单)
|
||||
*/
|
||||
title: string;
|
||||
/**
|
||||
* 标签页标题(可空;空则回退 title;运行时 setTabTitle 写入 newTabTitle 优先生效)
|
||||
*/
|
||||
tabTitle?: string;
|
||||
/**
|
||||
* 运行时覆盖的标签标题(如概览页动态名)
|
||||
*/
|
||||
newTabTitle?: string;
|
||||
}
|
||||
|
||||
// 定义递归类型以将 RouteRecordRaw 的 component 属性更改为 string
|
||||
|
||||
@@ -41,7 +41,8 @@ const style = computed(() => {
|
||||
const tabsView = computed(() => {
|
||||
return props.tabs.map((tab) => {
|
||||
const { fullPath, meta, name, path, key } = tab || {};
|
||||
const { affixTab, icon, newTabTitle, tabClosable, title } = meta || {};
|
||||
const { affixTab, icon, newTabTitle, tabClosable, tabTitle, title } =
|
||||
meta || {};
|
||||
return {
|
||||
affixTab: !!affixTab,
|
||||
closable: Reflect.has(meta, 'tabClosable') ? !!tabClosable : true,
|
||||
@@ -51,7 +52,8 @@ const tabsView = computed(() => {
|
||||
meta,
|
||||
name,
|
||||
path,
|
||||
title: (newTabTitle || title || name) as string,
|
||||
// 运行时覆盖 > 配置 tabTitle > 侧栏 title
|
||||
title: (newTabTitle || tabTitle || title || name) as string,
|
||||
} as TabConfig;
|
||||
});
|
||||
});
|
||||
|
||||
@@ -48,7 +48,8 @@ const typeWithClass = computed(() => {
|
||||
const tabsView = computed(() => {
|
||||
return props.tabs.map((tab) => {
|
||||
const { fullPath, meta, name, path, key } = tab || {};
|
||||
const { affixTab, icon, newTabTitle, tabClosable, title } = meta || {};
|
||||
const { affixTab, icon, newTabTitle, tabClosable, tabTitle, title } =
|
||||
meta || {};
|
||||
return {
|
||||
affixTab: !!affixTab,
|
||||
closable: Reflect.has(meta, 'tabClosable') ? !!tabClosable : true,
|
||||
@@ -58,7 +59,8 @@ const tabsView = computed(() => {
|
||||
meta,
|
||||
name,
|
||||
path,
|
||||
title: (newTabTitle || title || name) as string,
|
||||
// 运行时覆盖 > 配置 tabTitle > 侧栏 title
|
||||
title: (newTabTitle || tabTitle || title || name) as string,
|
||||
} as TabConfig;
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user