element/examples/route.config.js

39 lines
808 B
JavaScript
Raw Normal View History

2016-07-27 14:15:02 +08:00
import navConfig from './nav.config.json';
const registerRoute = (config) => {
2016-07-27 17:05:28 +08:00
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,
2016-08-17 13:53:56 +08:00
meta: {
title: page.title || page.name,
description: page.description
},
2016-07-27 17:05:28 +08:00
component: component.default || component
});
})
);
2016-07-27 14:15:02 +08:00
return { route, navs: config };
};
const route = registerRoute(navConfig);
2016-07-27 17:05:28 +08:00
route.route.push({
path: '/changelog',
component: require('../CHANGELOG.md')
});
2016-07-27 14:15:02 +08:00
2016-07-27 17:05:28 +08:00
route.route.push({
path: '*',
component: require('./docs/home.md')
});
export const navs = route.navs;
export default route.route;