feat(cli): support more features

This commit is contained in:
陈嘉涵
2019-11-19 16:25:05 +08:00
parent b61f331f7a
commit abe15a63fc
16 changed files with 1112 additions and 139 deletions

View File

@@ -1,24 +1,28 @@
import decamelize from 'decamelize';
import { documents } from '../../dist/desktop-config';
const routes = [];
const names = Object.keys(documents);
Object.keys(documents).forEach((name, index) => {
if (index === 0) {
routes.push({
path: '*',
redirect: () => `/${names[0]}`
});
}
routes.push({
path: '/home',
component: documents.Home
});
routes.push({
path: '*',
redirect: '/home'
});
names.forEach(name => {
routes.push({
name,
component: documents[name],
path: `/${name}`,
path: `/${decamelize(name, '-')}`,
meta: {
name
}
});
});
export default routes;
export { routes };