feat: 菜单侧栏标题与标签标题拆分并支持 tab_title 回退

This commit is contained in:
2026-09-05 18:27:53 +08:00
parent d99d8352b6
commit ebca4d093a
19 changed files with 119 additions and 21 deletions
@@ -13,8 +13,10 @@ export namespace MenuDTO {
name: string;
/** 路由名称(Vue Router name,建议英文唯一) */
routeName?: string;
/** 菜单标题 */
/** 菜单标题(侧栏) */
title?: string;
/** 标签页标题(可空;空则回退 title) */
tabTitle?: string;
/** 路由路径 */
path?: string;
/** 组件路径 */
@@ -47,8 +49,10 @@ export namespace MenuDTO {
name: string;
/** 路由名称(Vue Router name,建议英文唯一) */
routeName?: string;
/** 菜单标题 */
/** 菜单标题(侧栏) */
title?: string;
/** 标签页标题(可空;空则回退 title) */
tabTitle?: string;
/** 路由路径 */
path?: string;
/** 组件路径 */
@@ -16,8 +16,10 @@ export namespace MenuVO {
name: string;
/** 路由名称(Vue Router name) */
routeName?: string;
/** 菜单标题 */
/** 菜单标题(侧栏) */
title?: string;
/** 标签页标题(可空;空则回退 title) */
tabTitle?: string;
/** 路由路径 */
path?: string;
/** 组件路径 */
@@ -72,8 +72,10 @@ export namespace UserVO {
id: number;
/** 父路由ID */
parentId?: number;
/** 路由标题 */
/** 路由标题(侧栏) */
title: string;
/** 标签页标题(可空;空则回退 title) */
tabTitle?: string;
/** 路由图标 */
icon?: string;
/** 顺序 */
@@ -68,6 +68,8 @@ interface FormData {
name: string;
routeName: string;
title: string;
/** 标签页标题,空则回退菜单标题 */
tabTitle: string;
path: string;
component: string;
redirect: string;
@@ -87,6 +89,7 @@ const formData = ref<FormData>({
name: '',
routeName: '',
title: '',
tabTitle: '',
path: '',
component: '',
redirect: '',
@@ -350,6 +353,7 @@ function open(edit: boolean, record?: MenuVO.MenuInfo) {
name: record.name,
routeName: record.routeName || '',
title: record.title || '',
tabTitle: record.tabTitle || '',
path: record.path || '',
component: record.component || '',
redirect: record.redirect || '',
@@ -380,6 +384,7 @@ function open(edit: boolean, record?: MenuVO.MenuInfo) {
name: '',
routeName: '',
title: '',
tabTitle: '',
path: '',
component: '',
redirect: '',
@@ -399,6 +404,7 @@ function open(edit: boolean, record?: MenuVO.MenuInfo) {
name: '',
routeName: '',
title: '',
tabTitle: '',
path: '',
component: '',
redirect: '',
@@ -490,6 +496,7 @@ async function handleSubmit() {
...formData.value,
parentId: formData.value.parentId ?? null,
routeName: formData.value.routeName?.trim() || null,
tabTitle: formData.value.tabTitle?.trim() || null,
icon: formData.value.icon?.trim() || null,
iconSvg: formData.value.iconSvg?.trim() || null,
superMenu: formData.value.superMenu ? 1 : 0,
@@ -635,7 +642,17 @@ defineExpose({
</Form.Item>
<Form.Item label="菜单标题" name="title">
<Input v-model:value="formData.title" placeholder="请输入菜单标题" />
<Input
v-model:value="formData.title"
placeholder="侧边菜单显示名称"
/>
</Form.Item>
<Form.Item label="标签标题" name="tabTitle">
<Input
v-model:value="formData.tabTitle"
placeholder="可空;空则标签用菜单标题"
/>
</Form.Item>
<Form.Item label="路由路径" name="path">
@@ -92,6 +92,12 @@ const menuTableBaseColumns: VxeGridProps<any>['columns'] = [
minWidth: 150,
showOverflow: 'tooltip' as const,
},
{
field: 'tabTitle',
title: '标签标题',
minWidth: 120,
showOverflow: 'tooltip' as const,
},
{
field: 'icon',
title: '图标',