2020-04-19 11:50:32 +08:00
|
|
|
import { uniqueId } from 'lodash'
|
|
|
|
|
|
2018-07-17 22:03:45 +08:00
|
|
|
// 插件
|
|
|
|
|
import demoPlugins from './modules/demo-plugins'
|
|
|
|
|
// 组件
|
|
|
|
|
import demoComponents from './modules/demo-components'
|
2020-08-31 22:29:25 +08:00
|
|
|
// 功能
|
2018-07-17 22:03:45 +08:00
|
|
|
import demoPlayground from './modules/demo-playground'
|
|
|
|
|
|
2020-04-19 11:50:32 +08:00
|
|
|
/**
|
|
|
|
|
* @description 给菜单数据补充上 path 字段
|
|
|
|
|
* @description https://github.com/d2-projects/d2-admin/issues/209
|
|
|
|
|
* @param {Array} menu 原始的菜单数据
|
|
|
|
|
*/
|
|
|
|
|
function supplementPath (menu) {
|
|
|
|
|
return menu.map(e => ({
|
|
|
|
|
...e,
|
|
|
|
|
path: e.path || uniqueId('d2-menu-empty-'),
|
|
|
|
|
...e.children ? {
|
|
|
|
|
children: supplementPath(e.children)
|
|
|
|
|
} : {}
|
|
|
|
|
}))
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-17 22:03:45 +08:00
|
|
|
// 菜单 侧边栏
|
2020-04-19 11:50:32 +08:00
|
|
|
export const menuAside = supplementPath([
|
2018-07-17 22:03:45 +08:00
|
|
|
demoComponents,
|
2018-07-25 09:47:43 +08:00
|
|
|
demoPlugins,
|
2020-11-02 12:11:17 +08:00
|
|
|
demoPlayground
|
2020-04-19 11:50:32 +08:00
|
|
|
])
|
2018-07-17 22:03:45 +08:00
|
|
|
|
|
|
|
|
// 菜单 顶栏
|
2020-04-19 11:50:32 +08:00
|
|
|
export const menuHeader = supplementPath([
|
2018-07-17 22:03:45 +08:00
|
|
|
{
|
|
|
|
|
path: '/index',
|
|
|
|
|
title: '首页',
|
|
|
|
|
icon: 'home'
|
|
|
|
|
},
|
2020-09-01 15:31:55 +08:00
|
|
|
demoPlayground,
|
2020-08-31 22:29:25 +08:00
|
|
|
demoComponents,
|
2020-11-02 12:11:17 +08:00
|
|
|
demoPlugins
|
2020-04-19 11:50:32 +08:00
|
|
|
])
|