mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
Add extendRoutes option
This commit is contained in:
parent
8f4fbc1bdb
commit
1051b733f9
@ -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')
|
||||||
}
|
}
|
||||||
|
@ -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: {}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user