feat(cli): support more features

This commit is contained in:
陈嘉涵
2019-11-21 14:43:25 +08:00
parent b61f331f7a
commit abe15a63fc
16 changed files with 1112 additions and 139 deletions
+14 -9
View File
@@ -1,24 +1,29 @@
import decamelize from 'decamelize';
import DemoHome from './components/DemoHome';
import { demos } from '../../dist/mobile-config';
const routes = [];
const names = Object.keys(demos);
Object.keys(demos).forEach((name, index) => {
if (index === 0) {
routes.push({
path: '*',
redirect: () => `/${names[0]}`
});
}
routes.push({
path: '/home',
component: DemoHome
});
routes.push({
path: '*',
redirect: '/home'
});
names.forEach(name => {
routes.push({
name,
component: demos[name],
path: `/${name}`,
path: `/${decamelize(name, '-')}`,
meta: {
name
}
});
});
export default routes;
export { routes };