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

关于动态菜单的实现的问题 #153

Open
jipengwei opened this issue Apr 1, 2023 · 8 comments
Open

关于动态菜单的实现的问题 #153

jipengwei opened this issue Apr 1, 2023 · 8 comments
Assignees
Labels
enhancement New feature or request

Comments

@jipengwei
Copy link

tdesign-react-starter 版本

0.31

重现链接

No response

重现步骤

目前菜单是用路由中的设置,实际开发使用中菜单不是定死的,是需要按照不同权限显示不同的菜单,官方也没有说明如何实现动态菜单,实践中使用 redux 或 接口返回数据 对路由进行过滤 例如(不一定这么写只是个说明要对一些菜单进行过滤):
const allRoutes = [...routes, ...dashboard, ...list, ...form, ...detail, ...result, ...user, ...login, ...otherRoutes];
// return allRoutes.filter(c=>c.)
尝试了各种数十种办法和在Menu.tsx中也进行过滤,但凡只要汲及操作路由操作都是报错白屏,折腾一天无解. 错误主要在
renderMenuItems 中的
<SubMenu key={routerPath} value={routerPath} title={title} icon={Icon ? : undefined}>
{renderMenuItems(children, routerPath)}

这一块!求方案
0230401222442

期望结果

No response

实际结果

No response

框架版本

react 1.0.5

浏览器版本

No response

系统版本

No response

Node版本

No response

补充说明

No response

@github-actions
Copy link

github-actions bot commented Apr 1, 2023

👋 @jipengwei,感谢给 TDesign 提出了 issue。
请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。

@github-actions
Copy link

github-actions bot commented Apr 1, 2023

♥️ 有劳 @xucz 尽快确认问题。
确认有效后将下一步计划和可能需要的时间回复给 @jipengwei

@uyoungco
Copy link

uyoungco commented Apr 7, 2023

这个问题也在困扰我,希望大佬给一套思路让我们启发一下 @xucz

@uyarn
Copy link
Collaborator

uyarn commented Apr 12, 2023

动态路由还没加到react的页面模板过来 我们这个月尽量也同步到react这边 如果有兴趣贡献也欢迎提PR

@uyarn uyarn added the enhancement New feature or request label Apr 12, 2023
@legend91325
Copy link

@uyarn 进展如何了?

@zhanyabin
Copy link

@uyarn 动态路由还没加么

@SuperLeven
Copy link

很复杂的实现了动态路由,在官方解决方案出来之前可以参考一下,不喜勿喷:https://github.com/SuperLeven/tdesign-react-starter

@SuperLeven
Copy link

报错原因见:#179

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants