Allow load multiple modules
This commit is contained in:
parent
a4c49d6634
commit
c770cd017e
|
|
@ -19,6 +19,9 @@ if (process.env.NODE_ENV === 'development') {
|
||||||
route => (new RegExp(`^${route.path}$`, 'i')).test(blessing.route)
|
route => (new RegExp(`^${route.path}$`, 'i')).test(blessing.route)
|
||||||
)
|
)
|
||||||
if (route) {
|
if (route) {
|
||||||
|
if (route.module) {
|
||||||
|
Promise.all(route.module.map(m => m()))
|
||||||
|
}
|
||||||
if (route.component) {
|
if (route.component) {
|
||||||
Vue.prototype.$route = (new RegExp(`^${route.path}$`, 'i')).exec(blessing.route)
|
Vue.prototype.$route = (new RegExp(`^${route.path}$`, 'i')).exec(blessing.route)
|
||||||
// eslint-disable-next-line no-new
|
// eslint-disable-next-line no-new
|
||||||
|
|
@ -29,8 +32,6 @@ if (process.env.NODE_ENV === 'development') {
|
||||||
},
|
},
|
||||||
render: h => h(route.component),
|
render: h => h(route.component),
|
||||||
})
|
})
|
||||||
} else if (route.script) {
|
|
||||||
route.script()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ export default [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'admin',
|
path: 'admin',
|
||||||
script: () => import('./admin/Dashboard'),
|
module: [() => import('./admin/Dashboard')],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'admin/users',
|
path: 'admin/users',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user