Ant-design-pro: V4 子路权限不继承

Created on 23 Jul 2019  ·  3Comments  ·  Source: ant-design/ant-design-pro

  {
      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不会跳到登录页?

Inactive

Most helpful comment

我的做法是在 pages 底下的 Authorized.jsx 里 getRouteAuthority 函数加一些判断。

image

且根路由的配置如下

image

打印 Authorized.jsx 里的routes看看应该会发现,可多尝试看看

All 3 comments

同样的问题

同样的问题

我的做法是在 pages 底下的 Authorized.jsx 里 getRouteAuthority 函数加一些判断。

image

且根路由的配置如下

image

打印 Authorized.jsx 里的routes看看应该会发现,可多尝试看看

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zhuanglong picture zhuanglong  ·  3Comments

Yoping picture Yoping  ·  3Comments

RichardStark picture RichardStark  ·  3Comments

suifan picture suifan  ·  3Comments

skyFi picture skyFi  ·  3Comments