mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
add optional param by default
This commit is contained in:
parent
4c3f7abb1d
commit
904c4e5793
@ -229,8 +229,15 @@ function createRoutes (files, srcDir) {
|
||||
}
|
||||
|
||||
function cleanChildrenRoutes (routes, isChild = false) {
|
||||
let isOptional = true
|
||||
routes.forEach((route) => {
|
||||
route.path = (isChild) ? route.path.replace('/', '') : route.path
|
||||
if (route.path === '') {
|
||||
isOptional = false
|
||||
}
|
||||
if (isChild && isOptional && route.path.includes(':')) {
|
||||
route.path += '?'
|
||||
}
|
||||
if (route.children) {
|
||||
delete route.name
|
||||
route.children = cleanChildrenRoutes(route.children, true)
|
||||
|
Loading…
Reference in New Issue
Block a user