Allow load multiple modules

This commit is contained in:
Pig Fang 2019-03-19 19:18:24 +08:00
parent a4c49d6634
commit c770cd017e
2 changed files with 4 additions and 3 deletions

View File

@ -19,6 +19,9 @@ if (process.env.NODE_ENV === 'development') {
route => (new RegExp(`^${route.path}$`, 'i')).test(blessing.route)
)
if (route) {
if (route.module) {
Promise.all(route.module.map(m => m()))
}
if (route.component) {
Vue.prototype.$route = (new RegExp(`^${route.path}$`, 'i')).exec(blessing.route)
// eslint-disable-next-line no-new
@ -29,8 +32,6 @@ if (process.env.NODE_ENV === 'development') {
},
render: h => h(route.component),
})
} else if (route.script) {
route.script()
}
}
}

View File

@ -21,7 +21,7 @@ export default [
},
{
path: 'admin',
script: () => import('./admin/Dashboard'),
module: [() => import('./admin/Dashboard')],
},
{
path: 'admin/users',