filterAsyncRouter.js
367 Bytes
export function filterAsyncRouter (routers){
let data = routers.map(router=>{
var obj = {}
obj.path = router.path
obj.name = router.code
obj.component = loadView(router.path)
return obj
})
return data
}
function loadView (viewPath) {
return r => require.ensure([], () => r(require(`@/views${viewPath}/index`)))
}