mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
fix: only encode non dynamic path params (#8421)
This commit is contained in:
parent
68d8fb8487
commit
49c293b25f
@ -201,9 +201,10 @@ export const createRoutes = function createRoutes ({
|
|||||||
} else if (key === 'index' && i + 1 === keys.length) {
|
} else if (key === 'index' && i + 1 === keys.length) {
|
||||||
route.path += i > 0 ? '' : '/'
|
route.path += i > 0 ? '' : '/'
|
||||||
} else {
|
} else {
|
||||||
route.path += '/' + getRoutePathExtension(key)
|
const isDynamic = key.startsWith('_')
|
||||||
|
route.path += '/' + getRoutePathExtension(isDynamic ? key : encodeURIComponent(decodeURIComponent(key)))
|
||||||
|
|
||||||
if (key.startsWith('_') && key.length > 1) {
|
if (isDynamic && key.length > 1) {
|
||||||
route.path += '?'
|
route.path += '?'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ import scrollBehavior from './router.scrollBehavior.js'
|
|||||||
}
|
}
|
||||||
// @see: https://router.vuejs.org/api/#router-construction-options
|
// @see: https://router.vuejs.org/api/#router-construction-options
|
||||||
res += '{'
|
res += '{'
|
||||||
res += firstIndent + 'path: ' + JSON.stringify(encodeURI(decodeURI(route.path)))
|
res += firstIndent + 'path: ' + JSON.stringify(route.path)
|
||||||
res += (route.components) ? nextIndent + 'components: {' + resMap + '\n' + baseIndent + tab + '}' : ''
|
res += (route.components) ? nextIndent + 'components: {' + resMap + '\n' + baseIndent + tab + '}' : ''
|
||||||
res += (route.component) ? nextIndent + 'component: ' + route._name : ''
|
res += (route.component) ? nextIndent + 'component: ' + route._name : ''
|
||||||
res += (route.redirect) ? nextIndent + 'redirect: ' + JSON.stringify(route.redirect) : ''
|
res += (route.redirect) ? nextIndent + 'redirect: ' + JSON.stringify(route.redirect) : ''
|
||||||
|
Loading…
Reference in New Issue
Block a user