mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 16:12:12 +00:00
fix: dynamic routes must start with an underscore
Folders or files within `pages/` should only lead to dynamic routes, if they start with an underscore. Previously, folders like `some_folder` would lead to a route parameter `folder` being introduced.
This commit is contained in:
parent
f57096e572
commit
751aae38d4
@ -297,8 +297,13 @@ export const createRoutes = function createRoutes(files, srcDir, pagesDir) {
|
||||
if (key === 'index' && i + 1 === keys.length) {
|
||||
route.path += i > 0 ? '' : '/'
|
||||
} else {
|
||||
route.path += '/' + (key === '_' ? '*' : key.replace('_', ':'))
|
||||
if (key !== '_' && key.indexOf('_') !== -1) {
|
||||
route.path += '/' +
|
||||
(key === '_'
|
||||
? '*'
|
||||
: key.indexOf('_') === 0
|
||||
? key.replace('_', ':')
|
||||
: key)
|
||||
if (key !== '_' && key.indexOf('_') === 0) {
|
||||
route.path += '?'
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user