umijs / umi

A framework in react community ✨
https://umijs.org
MIT License
15.34k stars 2.65k forks source link

3级路由会跳转到2级 #2007

Closed supercat55 closed 5 years ago

supercat55 commented 5 years ago
 path: '/',
    component: '../layouts/BasicLayout',
    Routes: ['src/pages/Authorized'],
    routes: [
      { path: '/', redirect: '/app/home' },
      { path: '/app/home', component: './Home/index' },
      {
        path: '/role',
        name: '角色管理',
        icon: 'team',
        routes: [
          {
            path: '/role/manage',
            name: '角色管理',
            component: './Role/index',
            routes: [
              {
                path: '/role/manage/a',
                name: '添加',
                hideInMenu: true,
                component: './Role/actionRole',
              }
            ]
          }
        ]
      },

这是我的路由配置,当我地址是/role/manage/a 还是会显示到2级/role/manage的component

sorrycc commented 5 years ago

这是嵌套关系,先显示 /role/manage 再显示 /role/manage/a,你需要在 /role/manage 通过 props.children 把 /role/manage/a 展示出来。

succulen-plants commented 5 years ago

@sorrycc 能理解成, 无法解析三级路由吗, 我也遇到这个问题

bincute commented 4 years ago

sorry, 没看懂,能细说一下吗?@sorrycc

wanglianjie91 commented 3 years ago

@scouttyg 我现在的需求是,路由需要嵌套关系(为了生成面包屑),但是layout需要用同一个。

{ path: '/', component: '@/layouts/basiclayout', routes: [ { path: '/news/list', name: '新闻列表', component: './news/list', icon: 'list', routes: [ { path: '/news/list/add', name: '新增新闻', component: './news/add', hideInMenu: true, } ], },

wanglianjie91 commented 3 years ago

@sorrycc