add name on router for pages component

This commit is contained in:
Alexandre Chopin 2016-12-03 15:12:05 +01:00
parent ddbffcc8af
commit 4c33c3c7f6

View File

@ -146,8 +146,9 @@ function * generateRoutesAndFiles () {
let routes = []
files.forEach((file) => {
let path = file.replace(/^pages/, '').replace(/index\.vue$/, '/').replace(/\.vue$/, '').replace(/\/{2,}/g, '/')
let name = file.replace(/^pages/, '').replace(/\.vue$/, '').replace(/\/{2,}/g, '/').split('/').slice(1).join('-')
if (basename(path)[0] === '_') return
routes.push({ path: path, component: r(this.dir, file) })
routes.push({ path: path, component: r(this.dir, file), name: name })
})
// Concat pages routes and custom routes in this.routes
this.routes = routes.concat(this.options.router.routes)