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

子路由默认继承父类的路由 unaccessible 属性问题 #16

Open
huandhu opened this issue Sep 2, 2021 · 0 comments
Open

子路由默认继承父类的路由 unaccessible 属性问题 #16

huandhu opened this issue Sep 2, 2021 · 0 comments

Comments

@huandhu
Copy link

huandhu commented Sep 2, 2021

开了项目源码发现子路由默认继承是父路由的 unaccessible 属性, 相关源码如下:

 // 可能有打平 的事情发生,所以都执行一下
      childRoutes.forEach(childRoute => {
        childRoute.unaccessible = !currentRouteAccessible;
      });

可是这样的代码逻辑会导致子路由失去自定义 unaccessible 的能力,所以我觉得代码是否应该改为:

childRoutes.forEach(childRoute => {
        childRoute.unaccessible = childRoute.unaccessible || !currentRouteAccessible;
      });

会更合理一点。之所以这么改是最近的需求有需要独自控制子路由的情况,而这句代码导致 access 文件返回的函数需要写全量路由权限,而不能使用缺损的路由权限

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