diff --git a/lib/build/index.js b/lib/build/index.js index 56c6a5aa16..93cf01e393 100644 --- a/lib/build/index.js +++ b/lib/build/index.js @@ -252,7 +252,10 @@ function cleanChildrenRoutes (routes, isChild = false) { if ((isChild && /-index$/.test(route.name)) || (!isChild && route.name === 'index')) { 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)) { parents.push(route.name) } else {