fix(utils): trailingSlash causes error with dynamic nuxt-child routes (#9505)

This commit is contained in:
Mohammad Saleh Fadaei 2021-07-01 17:26:08 +04:30 committed by GitHub
parent 0742f59e24
commit 20f481f6f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -56,7 +56,7 @@ function cleanChildrenRoutes (routes, isChild = false, routeNameSplitter = '-',
route.path = isChild ? route.path.replace('/', '') : route.path
if (route.path.includes('?')) {
if (route.name.endsWith(`${routeNameSplitter}index`)) {
route.path = route.path.replace(/\?$/, '')
route.path = route.path.replace(/\?\/?$/, trailingSlash ? '/' : '')
}
const names = route.name.replace(regExpParentRouteName, '').split(routeNameSplitter)
const paths = route.path.split('/')