修改获取树形结构数据的翻译
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user