fix: extra menu title follow locale change (#5006)
parent
fccbe44cf7
commit
9b73792dc9
|
@ -110,10 +110,19 @@ const {
|
||||||
sidebarVisible,
|
sidebarVisible,
|
||||||
} = useMixedMenu();
|
} = useMixedMenu();
|
||||||
|
|
||||||
function wrapperMenus(menus: MenuRecordRaw[]) {
|
/**
|
||||||
return mapTree(menus, (item) => {
|
* 包装菜单,翻译菜单名称
|
||||||
return { ...cloneDeep(item), name: $t(item.name) };
|
* @param menus 原始菜单数据
|
||||||
});
|
* @param deep 是否深度包装。对于双列布局,只需要包装第一层,因为更深层的数据会在扩展菜单中重新包装
|
||||||
|
*/
|
||||||
|
function wrapperMenus(menus: MenuRecordRaw[], deep: boolean = true) {
|
||||||
|
return deep
|
||||||
|
? mapTree(menus, (item) => {
|
||||||
|
return { ...cloneDeep(item), name: $t(item.name) };
|
||||||
|
})
|
||||||
|
: menus.map((item) => {
|
||||||
|
return { ...cloneDeep(item), name: $t(item.name) };
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleSidebar() {
|
function toggleSidebar() {
|
||||||
|
@ -257,7 +266,7 @@ const headerSlots = computed(() => {
|
||||||
<template #mixed-menu>
|
<template #mixed-menu>
|
||||||
<LayoutMixedMenu
|
<LayoutMixedMenu
|
||||||
:active-path="extraActiveMenu"
|
:active-path="extraActiveMenu"
|
||||||
:menus="wrapperMenus(headerMenus)"
|
:menus="wrapperMenus(headerMenus, false)"
|
||||||
:rounded="isMenuRounded"
|
:rounded="isMenuRounded"
|
||||||
:theme="sidebarTheme"
|
:theme="sidebarTheme"
|
||||||
@default-select="handleDefaultSelect"
|
@default-select="handleDefaultSelect"
|
||||||
|
|
Loading…
Reference in New Issue