Skip to content

[BUG] layout 菜单错误 #266

@luocong2016

Description

@luocong2016

🐛 Bug 描述 Bug description

  1. 非 '/'开始的 path 名字相同,被认为是激活了同个路由
path: "index"

image

看了下源码

// packages/pro-layout/src/components/SiderMenu/BaseMenu.tsx
// 这里 memu key 使用的是 path
  1. getMenuData, clearMenuItem typescript 类型兼容eslint报错, 只能加 any; 源码拷贝到本地是不报错的
const { menuData } = getMenuData(clearMenuItem(router.getRoutes() as any));
  1. clearMenuItem 关于 name 强制绑定这个明显在 vue 中是有问题的
// 代码使用了 to -> name 来跳转
  1. getMenuData 强制了路由数据结构必须是以跟节点开始展示, 但业务开发不一定以'/' 开始,可能是一个前端微应用。
    也可能是一个常驻路由和业务路由分开的路由。
const router = [{
  path: '/',
  name: xxx
  children: [xxx]
}]
  1. 面包屑参考
    vue-element-admin

🏞 期望结果 Desired result

  1. 分离菜单底层组件强制绑定的 name
  2. path 非 / 开头的建议使用 fullpath,其实 formatRelativePath 已经实现

🚑 其他信息 Other information

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions