From 634f0f1115d669b8f39d8b0faf9513afb0598b6d Mon Sep 17 00:00:00 2001 From: lsymicc Date: Fri, 6 Jun 2025 09:38:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=8E=B7=E5=8F=96=E6=A0=91?= =?UTF-8?q?=E5=BD=A2=E7=BB=93=E6=9E=84=E6=95=B0=E6=8D=AE=E7=9A=84=E7=BF=BB?= =?UTF-8?q?=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/views/system/menu/index.vue | 27 ++++++++++++------------ 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/ruoyi-ui/src/views/system/menu/index.vue b/ruoyi-ui/src/views/system/menu/index.vue index 2f42dad..a013490 100644 --- a/ruoyi-ui/src/views/system/menu/index.vue +++ b/ruoyi-ui/src/views/system/menu/index.vue @@ -440,25 +440,24 @@ export default { this.menuOptions = [] // 主类目 const menu = { menuId: 0, menuName: this.$t('systemManagement_MenuManagement.MainTitle'), children: [] } - menu.children = this.handleTree(response.data, "menuId") + const translatedData = this.translateMenuLabels(response.data); + menu.children = this.handleTree(translatedData, "menuId") this.menuOptions.push(menu) - console.log(response.data) - console.log(this.menuOptions) - // 国际化菜单名称 - // const translatedData = this.translateMenuLabels(response.data); - // this.menuOptions = translatedData + // console.log(response.data) + // console.log(menu.children) + // console.log(this.menuOptions) }) }, - //@@@ - // translateMenuLabels(data) { - // return data.map(item => ({ - // ...item, - // label: this.$t(item.label), - // children: item.children ? this.translateMenuLabels(item.children) : [] - // })); - // }, + //@@@ 递归处理树形结构 + translateMenuLabels(data) { + return data.map(item => ({ + ...item, + menuName: this.$t(item.menuName), + children: item.children ? this.translateMenuLabels(item.children) : [] + })); + }, // 取消按钮 cancel() { this.open = false