Add extendRoutes option

This commit is contained in:
Sébastien Chopin 2017-01-18 17:25:38 +01:00
parent 8f4fbc1bdb
commit 1051b733f9
2 changed files with 6 additions and 5 deletions

View File

@ -184,6 +184,10 @@ function * generateRoutesAndFiles () {
} }
// Format routes for the lib/app/router.js template // Format routes for the lib/app/router.js template
templateVars.router.routes = createRoutes(files, this.srcDir) templateVars.router.routes = createRoutes(files, this.srcDir)
if (typeof this.options.router.extendRoutes === 'function') {
// let the user extend the routes
this.options.router.extendRoutes(templateVars.router.routes)
}
if (layoutsFiles.includes('layouts/error.vue')) { if (layoutsFiles.includes('layouts/error.vue')) {
templateVars.components.ErrorPage = r(this.srcDir, 'layouts/error.vue') templateVars.components.ErrorPage = r(this.srcDir, 'layouts/error.vue')
} }

View File

@ -19,10 +19,6 @@ class Nuxt {
constructor (options = {}) { constructor (options = {}) {
var defaults = { var defaults = {
// special options
_renderer: true,
_build: true,
// general options
dev: true, dev: true,
env: {}, env: {},
head: {}, head: {},
@ -41,7 +37,8 @@ class Nuxt {
}, },
router: { router: {
base: '/', base: '/',
linkActiveClass: 'nuxt-link-active' linkActiveClass: 'nuxt-link-active',
extendRoutes: null
}, },
build: {} build: {}
} }