mirror of
https://github.com/youzan/vant.git
synced 2025-10-19 01:54:48 +00:00
feat(cli): support more features
This commit is contained in:
@@ -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 };
|
||||
|
Reference in New Issue
Block a user