Pref: 路由菜单取title字段 而不是name,树结构数据修改 (#3666)
* perf: 修改路由菜单获取title字段 * perf: 调整树结构获取的数据源 * perf: 修改getI18nName 获取值方式 --------- Co-authored-by: 赵泽瑞 <zhaozerui@jilinxiangyun.com>
This commit is contained in:
parent
3d733de399
commit
0434e718ed
|
|
@ -79,7 +79,7 @@
|
||||||
const getShowMenu = computed(() => !props.item?.meta?.hideMenu);
|
const getShowMenu = computed(() => !props.item?.meta?.hideMenu);
|
||||||
const getIcon = computed(() => (props.item?.img ? undefined : props.item?.icon));
|
const getIcon = computed(() => (props.item?.img ? undefined : props.item?.icon));
|
||||||
const getImg = computed(() => props.item?.img);
|
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 getShowSubTitle = computed(() => !props.collapse || !props.parent);
|
||||||
const getIsCollapseParent = computed(() => !!props.collapse && !!props.parent);
|
const getIsCollapseParent = computed(() => !!props.collapse && !!props.parent);
|
||||||
const getLevelClass = computed(() => {
|
const getLevelClass = computed(() => {
|
||||||
|
|
|
||||||
|
|
@ -61,12 +61,12 @@ export function transformRouteToMenu(routeModList: AppRouteModule[], routerMappi
|
||||||
// 提取树指定结构
|
// 提取树指定结构
|
||||||
const list = treeMap(routeList, {
|
const list = treeMap(routeList, {
|
||||||
conversion: (node: AppRouteRecordRaw) => {
|
conversion: (node: AppRouteRecordRaw) => {
|
||||||
const { meta: { title, hideMenu = false } = {} } = node;
|
const { meta: { hideMenu = false } = {}, name } = node;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...(node.meta || {}),
|
...(node.meta || {}),
|
||||||
meta: node.meta,
|
meta: node.meta,
|
||||||
name: title,
|
name,
|
||||||
hideMenu,
|
hideMenu,
|
||||||
path: node.path,
|
path: node.path,
|
||||||
...(node.redirect ? { redirect: node.redirect } : {}),
|
...(node.redirect ? { redirect: node.redirect } : {}),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue