有两种菜单格式,一种是就只有一层,一种是有多层的

一、单层的菜单

ant design pro项目配置路由菜单

 

 首先在pages目录下新建一个文件目录

ant design pro项目配置路由菜单

 

 然后在config.js中进行配置

ant design pro项目配置路由菜单

 

 

{
    name: 'new_test',
    icon: 'table',
    path: '/new_test',
    component: './TestRoute/test_route',
}

最后在src\locales\zh-CN\menu.js中配置菜单

ant design pro项目配置路由菜单

 

 

//测试单层菜单路由
  'menu.new_test':'测试单层菜单配置',

二、多层菜单

ant design pro项目配置路由菜单

 

 首先也是在pages目录下新增目录文件

ant design pro项目配置路由菜单

 

  然后在config.js中进行配置

ant design pro项目配置路由菜单

 

{
    path: '/test',
    icon: 'setting',
    name: 'test',
    routes: [
        {
             name: 'button_page',
             path: 'button_page',
             component: './ButtonPages/button_page',
         },
     ],
}

最后在src\locales\zh-CN\menu.js中配置菜单

ant design pro项目配置路由菜单

 

 

//多层菜单
  'menu.test': '测试练习',
  'menu.test.button_page': '按钮页面',

以上都是简单的测试,不涉及后台请求动态创建菜单

相关文章:

  • 2021-07-17
  • 2021-07-04
  • 2021-04-27
  • 2022-12-23
  • 2021-04-13
  • 2021-08-21
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-20
  • 2022-12-23
  • 2022-12-23
  • 2021-04-01
相关资源
相似解决方案