刮刮前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

15 lines
436 B

module.exports = function parsePages(manifest, pages) {
const entryPagePath = pages[0].path
const router = {
entry: entryPagePath.substr(0, entryPagePath.lastIndexOf('/')),
pages: {}
}
pages.forEach(page => {
const lastIndex = page.path.lastIndexOf('/')
const key = page.path.substr(0, lastIndex)
router.pages[key] = {
component: page.path.substr(lastIndex + 1)
}
})
manifest.router = router
}