Pref: 路由菜单取title字段 而不是name,树结构数据修改 (#3666)

* perf: 修改路由菜单获取title字段

* perf: 调整树结构获取的数据源

* perf: 修改getI18nName 获取值方式

---------

Co-authored-by: 赵泽瑞 <zhaozerui@jilinxiangyun.com>
This commit is contained in:
Ze.Rui 2024-03-15 16:50:31 +08:00 committed by GitHub
parent 3d733de399
commit 0434e718ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -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(() => {

View File

@ -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 } : {}),