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

🧐[问题]关于菜单根据路由自动选中特性 #8962

Open
phoema opened this issue Jan 9, 2025 · 0 comments
Open

🧐[问题]关于菜单根据路由自动选中特性 #8962

phoema opened this issue Jan 9, 2025 · 0 comments

Comments

@phoema
Copy link

phoema commented Jan 9, 2025

提问前先看看:

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

🧐 问题描述

https://procomponents.ant.design/components/layout
中有两句话提到了自动选中菜单:
ProLayout 会根据 location.pathname 来自动选中菜单,并且自动生成相应的面包屑。如果不想使用可以自己配置 selectedKeys 和 openKeys 来进行受控配置。

ProLayout 会自动生成菜单,同时根据 pathname 进行自动选中。配合 PageContainer 可以实现自动推算面包屑和页面标题。如果和 Umi 配置使用,只需要将 Page 的 props 交给 ProLayout,ProLayout 会根据 config 中的 routers 的配置自动生成菜单。

这导致我们有一批隐藏菜单分散在各个一级菜单中,通过按钮链接跳转时会自动选中一级菜单。
我们现在的需求是,对于隐藏菜单,不进行自动选中。

根据第一句描述,我们可能需要自己配置 selectedKeys 和 openKeys
请问我的思路正确吗?应该怎么处理?

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