Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛[BUG]ProLayout的menu.request没法获取到异步菜单 #7799

Closed
q1uxu opened this issue Oct 19, 2023 · 2 comments
Closed

🐛[BUG]ProLayout的menu.request没法获取到异步菜单 #7799

q1uxu opened this issue Oct 19, 2023 · 2 comments

Comments

@q1uxu
Copy link
Contributor

q1uxu commented Oct 19, 2023

提问前先看看:

https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md

🐛 bug 描述

📷 复现步骤

🏞 期望结果

💻 复现代码

© 版本信息

  • ProComponents 版本: [e.g. 4.0.0]
  • umi 版本
  • 浏览器环境
  • 开发环境 [e.g. mac OS]

🚑 其他信息

@q1uxu
Copy link
Contributor Author

q1uxu commented Oct 19, 2023

找到原因了,request返回的菜单数据的子菜单字段应该是routes,而不是children。既然要用routes,为什么还要再弄个没用的children字段呢?

@q1uxu
Copy link
Contributor Author

q1uxu commented Oct 20, 2023

export interface MenuDataItem {
    children?: MenuDataItem[];
    hideChildrenInMenu?: boolean;
    hideInMenu?: boolean;
    icon?: any;
    locale?: string | false;
    name?: string;
    key?: string;
    pro_layout_parentKeys?: string[];
    path?: string;
    parentKeys?: string[];
    [key: string]: any;
}

ProLayout组件的menu.request、menuData、menuDataRender等参数用到的 MenuDataItem类型,就没写到菜单路由需要routes字段,只有children字段。看了官方示例才知道需要设置routes字段。这TS类型定义得也太坑了。

@q1uxu q1uxu closed this as completed Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant