修改获取树形结构数据的翻译

This commit is contained in:
lsymicc
2025-06-06 09:38:54 +08:00
parent f3c2e8accb
commit 634f0f1115

View File

@@ -440,25 +440,24 @@ export default {
this.menuOptions = [] this.menuOptions = []
// 主类目 // 主类目
const menu = { menuId: 0, menuName: this.$t('systemManagement_MenuManagement.MainTitle'), children: [] } 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) this.menuOptions.push(menu)
console.log(response.data) // console.log(response.data)
console.log(this.menuOptions) // console.log(menu.children)
// 国际化菜单名称 // console.log(this.menuOptions)
// const translatedData = this.translateMenuLabels(response.data);
// this.menuOptions = translatedData
}) })
}, },
//@@@ //@@@ 递归处理树形结构
// translateMenuLabels(data) { translateMenuLabels(data) {
// return data.map(item => ({ return data.map(item => ({
// ...item, ...item,
// label: this.$t(item.label), menuName: this.$t(item.menuName),
// children: item.children ? this.translateMenuLabels(item.children) : [] children: item.children ? this.translateMenuLabels(item.children) : []
// })); }));
// }, },
// 取消按钮 // 取消按钮
cancel() { cancel() {
this.open = false this.open = false