Ant-design-pro: 👑 [需求] Authorized组件重构讨论

Created on 29 Feb 2020  ·  3Comments  ·  Source: ant-design/ant-design-pro

🥰 需求描述

Authorized组件的实现非常复杂,涉及到多层嵌套、HOC、enclosure。项目中要对这个进行修改,难度很大。

🧐 解决方案

我在我的项目中试图把这个组件和user store合并,把authority内容存到user store里,把authorized组件简化并且成功运行。这样的重构可以统一代码的形式并方便其他组件使用redux对用户权限类进行操作而不用单独调用一个手写的函数。
想了解一下现在的这个实现是否有特殊考虑不做到store里?如果没有特别原因的话,我可以把代码整理好发一个pull request上来。

🏆 Feature Request

Most helpful comment

试试最佳实践的新组件

plugin-access https://github.com/umijs/plugin-access
这个和你的设想是一样的也是我们接下来会内置到 pro 的

All 3 comments

试试最佳实践的新组件

plugin-access https://github.com/umijs/plugin-access
这个和你的设想是一样的也是我们接下来会内置到 pro 的

@chenshuai2144
Authorized设计的确实有些复杂,不太实用
umi-access这个依赖需要umi3.x
目前自己实现了access
期待最佳实践。。

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gaoqiang19514 picture gaoqiang19514  ·  3Comments

952425340 picture 952425340  ·  3Comments

2uncle-code picture 2uncle-code  ·  3Comments

suifan picture suifan  ·  3Comments

Yoping picture Yoping  ·  3Comments