123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- const menuData = [
- {
- name: '主页',
- icon: 'dashboard',
- path: 'dashboard',
- },{
- name: '产品库',
- icon: 'shop',
- path: 'goods',
- },{
- name: '订单管理',
- icon: 'trademark',
- path: 'order',
- },{
- name: '销售统计',
- icon: 'area-chart',
- path: 'sold',
- },{
- name: '校区管理',
- icon: 'home',
- path: 'campus',
- },{
- name: '终端管理',
- icon: 'desktop',
- path: 'terminal',
- },{
- name: '前端展现',
- icon: 'setting',
- path: 'frontend',
- },{
- name: '账户信息',
- icon: 'user',
- path: 'merchant',
- },{
- name: '使用说明',
- icon: 'question-circle-o',
- path: 'help',
- },
- ];
- function formatter(data, parentPath = '') {
- const list = [];
- data.forEach((item) => {
- if (item.children) {
- list.push({
- ...item,
- path: `${parentPath}${item.path}`,
- children: formatter(item.children, `${parentPath}${item.path}/`),
- });
- } else {
- list.push({
- ...item,
- path: `${parentPath}${item.path}`,
- });
- }
- });
- return list;
- }
- export const getMenuData = () => formatter(menuData);
|