{
path: '/',
component: '../layouts/BasicLayout',
Routes: ['src/pages/Authorized'],
authority: ['admin', 'user'],
routes: [
{
path: '/',
redirect: '/form',
},
{
path: '/form',
name: 'form',
authority: ['admin', 'user'],
routes: [
{
path: '/form',
redirect: '/form/basic-form',
},
{
path: '/form/basic-form',
name: 'basic-form2',
component: './form/basic-form',
},
]
},
],
},
路由如上配置
1.直接访问/ 能进入页面,在/下配置了authority不会跳到登录页?
2.直接访问/form 跳转到登录页面,
3.直接访问/form/basic-form 能进入页面,在/和/form下配置了authority不会跳到登录页?
同样的问题
同样的问题
我的做法是在 pages 底下的 Authorized.jsx 里 getRouteAuthority 函数加一些判断。

且根路由的配置如下

打印 Authorized.jsx 里的routes看看应该会发现,可多尝试看看
Most helpful comment
我的做法是在 pages 底下的 Authorized.jsx 里 getRouteAuthority 函数加一些判断。
且根路由的配置如下
打印 Authorized.jsx 里的routes看看应该会发现,可多尝试看看