menu.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. const menuData = [
  2. {
  3. name: '主页',
  4. icon: 'dashboard',
  5. path: 'dashboard',
  6. },{
  7. name: '产品库',
  8. icon: 'shop',
  9. path: 'goods',
  10. },{
  11. name: '订单管理',
  12. icon: 'trademark',
  13. path: 'order',
  14. },{
  15. name: '销售统计',
  16. icon: 'area-chart',
  17. path: 'sold',
  18. },{
  19. name: '校区管理',
  20. icon: 'home',
  21. path: 'campus',
  22. },{
  23. name: '终端管理',
  24. icon: 'desktop',
  25. path: 'terminal',
  26. },{
  27. name: '前端展现',
  28. icon: 'setting',
  29. path: 'frontend',
  30. },{
  31. name: '账户信息',
  32. icon: 'user',
  33. path: 'merchant',
  34. },{
  35. name: '使用说明',
  36. icon: 'question-circle-o',
  37. path: 'help',
  38. },
  39. ];
  40. function formatter(data, parentPath = '') {
  41. const list = [];
  42. data.forEach((item) => {
  43. if (item.children) {
  44. list.push({
  45. ...item,
  46. path: `${parentPath}${item.path}`,
  47. children: formatter(item.children, `${parentPath}${item.path}/`),
  48. });
  49. } else {
  50. list.push({
  51. ...item,
  52. path: `${parentPath}${item.path}`,
  53. });
  54. }
  55. });
  56. return list;
  57. }
  58. export const getMenuData = () => formatter(menuData);