mirror of
https://gitee.com/ElemeFE/element.git
synced 2024-12-02 20:28:52 +08:00
39 lines
808 B
JavaScript
39 lines
808 B
JavaScript
import navConfig from './nav.config.json';
|
|
|
|
const registerRoute = (config) => {
|
|
let route = [];
|
|
config
|
|
.map(nav =>
|
|
nav.list.map(page => {
|
|
if (page.path === '/changelog') return;
|
|
const component = require(`./docs${page.path}.md`);
|
|
|
|
route.push({
|
|
path: page.path,
|
|
meta: {
|
|
title: page.title || page.name,
|
|
description: page.description
|
|
},
|
|
component: component.default || component
|
|
});
|
|
})
|
|
);
|
|
|
|
return { route, navs: config };
|
|
};
|
|
|
|
const route = registerRoute(navConfig);
|
|
|
|
route.route.push({
|
|
path: '/changelog',
|
|
component: require('../CHANGELOG.md')
|
|
});
|
|
|
|
route.route.push({
|
|
path: '*',
|
|
component: require('./docs/home.md')
|
|
});
|
|
|
|
export const navs = route.navs;
|
|
export default route.route;
|