Ant-design-pro: 🧐[问题] ant pro怎么实现菜单分组呢?

Created on 2 Nov 2019  ·  5Comments  ·  Source: ant-design/ant-design-pro

🧐 ant pro怎么实现菜单分组呢?

在menuItemRender里面尝试了遍历好像不太行,求指教

💻 示例代码

🚑 就是item1分组的这种效果


image

🕵🏻‍♀️ question

Most helpful comment

const routes = [
  {
    name: 'Navigation one',
    routes: [
      {
        name: 'item1',
        routes: [
          {
            name: 'option1',
          },
          {
            name: 'option2',
          },
        ],
      },
      {
        name: 'item2',
        routes: [
          {
            name: 'option1',
          },
          {
            name: 'option2',
          },
        ],
      },
    ],
  },
]

大概是这样的形式吧,你试试看

All 5 comments

路由分级就好了

路由分级就好了

有demo吗?研究一下午了

菜单是拿的路由数据转换的,会保持路由的层级结构
你只要给你的的路由配置那里往下加几层子路由试试就知道了
item1和item2是平级的,然后各自下面有两个option的子路由
可以参考一下umi路由这块的文档

菜单是拿的路由数据转换的,会保持路由的层级结构
你只要给你的的路由配置那里往下加几层子路由试试就知道了
item1和item2是平级的,然后各自下面有两个option的子路由
可以参考一下umi路由这块的文档

没看明白怎么配置,官网也找着没有这方面的例子啊 =.=

const routes = [
  {
    name: 'Navigation one',
    routes: [
      {
        name: 'item1',
        routes: [
          {
            name: 'option1',
          },
          {
            name: 'option2',
          },
        ],
      },
      {
        name: 'item2',
        routes: [
          {
            name: 'option1',
          },
          {
            name: 'option2',
          },
        ],
      },
    ],
  },
]

大概是这样的形式吧,你试试看

Was this page helpful?
0 / 5 - 0 ratings

Related issues

happier2 picture happier2  ·  3Comments

zhongjiewu picture zhongjiewu  ·  3Comments

wuyongdec picture wuyongdec  ·  3Comments

suifan picture suifan  ·  3Comments

kaoding picture kaoding  ·  3Comments