mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-14 10:04:05 +00:00
fix dynamic route optional
This commit is contained in:
parent
1a4822e38d
commit
c77fc45d9b
@ -252,7 +252,10 @@ function cleanChildrenRoutes (routes, isChild = false) {
|
|||||||
if ((isChild && /-index$/.test(route.name)) || (!isChild && route.name === 'index')) {
|
if ((isChild && /-index$/.test(route.name)) || (!isChild && route.name === 'index')) {
|
||||||
hasIndex = true
|
hasIndex = true
|
||||||
}
|
}
|
||||||
route.path = (hasIndex) ? route.path.replace('?', '') : route.path
|
let names = route.path.split('/')
|
||||||
|
if (hasIndex && (isChild || (!isChild && names[1] && names[1].indexOf('?') > -1))) {
|
||||||
|
route.path = route.path.replace('?', '')
|
||||||
|
}
|
||||||
if (/-index$/.test(route.name)) {
|
if (/-index$/.test(route.name)) {
|
||||||
parents.push(route.name)
|
parents.push(route.name)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user