Browse Source
Pref: 路由菜单取title字段 而不是name,树结构数据修改 (#3666)
* perf: 修改路由菜单获取title字段
* perf: 调整树结构获取的数据源
* perf: 修改getI18nName 获取值方式
---------
Co-authored-by: 赵泽瑞 <zhaozerui@jilinxiangyun.com>
pull/3678/head
Ze.Rui
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
3 additions and
3 deletions
-
src/components/SimpleMenu/src/SimpleSubMenu.vue
-
src/router/helper/menuHelper.ts
|
|
|
@ -79,7 +79,7 @@ |
|
|
|
const getShowMenu = computed(() => !props.item?.meta?.hideMenu); |
|
|
|
const getIcon = computed(() => (props.item?.img ? undefined : props.item?.icon)); |
|
|
|
const getImg = computed(() => props.item?.img); |
|
|
|
const getI18nName = computed(() => t(props.item?.name)); |
|
|
|
const getI18nName = computed(() => t(props.item?.meta?.title || props.item?.name)); |
|
|
|
const getShowSubTitle = computed(() => !props.collapse || !props.parent); |
|
|
|
const getIsCollapseParent = computed(() => !!props.collapse && !!props.parent); |
|
|
|
const getLevelClass = computed(() => { |
|
|
|
|
|
|
|
@ -61,12 +61,12 @@ export function transformRouteToMenu(routeModList: AppRouteModule[], routerMappi |
|
|
|
// 提取树指定结构
|
|
|
|
const list = treeMap(routeList, { |
|
|
|
conversion: (node: AppRouteRecordRaw) => { |
|
|
|
const { meta: { title, hideMenu = false } = {} } = node; |
|
|
|
const { meta: { hideMenu = false } = {}, name } = node; |
|
|
|
|
|
|
|
return { |
|
|
|
...(node.meta || {}), |
|
|
|
meta: node.meta, |
|
|
|
name: title, |
|
|
|
name, |
|
|
|
hideMenu, |
|
|
|
path: node.path, |
|
|
|
...(node.redirect ? { redirect: node.redirect } : {}), |
|
|
|
|