mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-17 06:01:34 +00:00
fix(utils): error when router.trailingSlash
is false
(#6515)
This commit is contained in:
parent
f28d12c913
commit
2d27a4d2dc
@ -176,7 +176,7 @@ export const createRoutes = function createRoutes ({
|
|||||||
})
|
})
|
||||||
if (trailingSlash !== undefined) {
|
if (trailingSlash !== undefined) {
|
||||||
route.pathToRegexpOptions = { ...route.pathToRegexpOptions, strict: true }
|
route.pathToRegexpOptions = { ...route.pathToRegexpOptions, strict: true }
|
||||||
route.path = route.path.replace(/\/+$/, '') + (trailingSlash ? '/' : '')
|
route.path = route.path.replace(/\/+$/, '') + (trailingSlash ? '/' : '') || '/'
|
||||||
}
|
}
|
||||||
|
|
||||||
parent.push(route)
|
parent.push(route)
|
||||||
|
@ -210,15 +210,6 @@ Array [
|
|||||||
|
|
||||||
exports[`util: route util: route create createRoutes should remove trailing slashes when configured to 1`] = `
|
exports[`util: route util: route create createRoutes should remove trailing slashes when configured to 1`] = `
|
||||||
Array [
|
Array [
|
||||||
Object {
|
|
||||||
"chunkName": "pages/index",
|
|
||||||
"component": "/some/nuxt/app/pages/index.vue",
|
|
||||||
"name": "index",
|
|
||||||
"path": "",
|
|
||||||
"pathToRegexpOptions": Object {
|
|
||||||
"strict": true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Object {
|
Object {
|
||||||
"chunkName": "pages/parent/index",
|
"chunkName": "pages/parent/index",
|
||||||
"component": "/some/nuxt/app/pages/parent/index.vue",
|
"component": "/some/nuxt/app/pages/parent/index.vue",
|
||||||
@ -269,6 +260,7 @@ Array [
|
|||||||
],
|
],
|
||||||
"chunkName": "pages/another_route/_id",
|
"chunkName": "pages/another_route/_id",
|
||||||
"component": "/some/nuxt/app/pages/another_route/_id.vue",
|
"component": "/some/nuxt/app/pages/another_route/_id.vue",
|
||||||
|
"name": "another_route-id",
|
||||||
"path": "/another_route/:id?",
|
"path": "/another_route/:id?",
|
||||||
"pathToRegexpOptions": Object {
|
"pathToRegexpOptions": Object {
|
||||||
"strict": true,
|
"strict": true,
|
||||||
@ -283,6 +275,15 @@ Array [
|
|||||||
"strict": true,
|
"strict": true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Object {
|
||||||
|
"chunkName": "pages/index",
|
||||||
|
"component": "/some/nuxt/app/pages/index.vue",
|
||||||
|
"name": "index",
|
||||||
|
"path": "/",
|
||||||
|
"pathToRegexpOptions": Object {
|
||||||
|
"strict": true,
|
||||||
|
},
|
||||||
|
},
|
||||||
Object {
|
Object {
|
||||||
"chunkName": "pages/_param",
|
"chunkName": "pages/_param",
|
||||||
"component": "/some/nuxt/app/pages/_param.vue",
|
"component": "/some/nuxt/app/pages/_param.vue",
|
||||||
|
Loading…
Reference in New Issue
Block a user