fix:联调权限接口
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
<template #title>{{ row.meta.title }}</template>
|
||||
</el-menu-item>
|
||||
</el-sub-menu>
|
||||
<el-menu-item v-else :index="item.path">
|
||||
<el-menu-item v-else :index="getFirstChildPath(item)">
|
||||
<el-icon v-if="item.meta?.icon"><component :is="item.meta.icon" /></el-icon>
|
||||
<template #title>{{ item.meta.title }}</template>
|
||||
</el-menu-item>
|
||||
@@ -68,6 +68,18 @@ const resolvePath = (parentPath: string, childPath: string) => {
|
||||
// 4. 返回拼接后的路径
|
||||
return `${parent}/${child}`;
|
||||
};
|
||||
/**
|
||||
* 获取菜单项的跳转路径
|
||||
* 如果是顶级菜单且有子项,点击应跳转到第一个子项
|
||||
*/
|
||||
const getFirstChildPath = (item: any) => {
|
||||
// 如果是顶级菜单且有子菜单
|
||||
if (item.children && item.children.length > 0) {
|
||||
return resolvePath(item.path, item.children[0].path);
|
||||
}
|
||||
// 如果没有子菜单,直接返回 item.path,但要确保它是以 / 开头
|
||||
return item.path.startsWith('/') ? item.path : `/${item.path}`;
|
||||
};
|
||||
|
||||
// 处理菜单选中事件
|
||||
const handleMenuSelect = (index: string) => {
|
||||
|
||||
Reference in New Issue
Block a user