diff --git a/src/helpers/routes.js b/src/helpers/routes.js index 0715b0f57..90e3cb146 100644 --- a/src/helpers/routes.js +++ b/src/helpers/routes.js @@ -116,12 +116,14 @@ exports.makeRoutes = (baseRoutes, { } } + const isChildWithRelativePath = isChild && !path.startsWith('/') + // Add route prefix if needed const shouldAddPrefix = ( // No prefix if app uses different locale domains !differentDomains && - // Only add prefix on top level routes - !isChild && + // No need to add prefix if child's path is relative + !isChildWithRelativePath && // Skip default locale if strategy is PREFIX_EXCEPT_DEFAULT !(locale === defaultLocale && strategy === STRATEGIES.PREFIX_EXCEPT_DEFAULT) ) diff --git a/test/fixture/basic/pages/posts/index.vue b/test/fixture/basic/pages/posts/index.vue index 04b161fae..7b55e555d 100644 --- a/test/fixture/basic/pages/posts/index.vue +++ b/test/fixture/basic/pages/posts/index.vue @@ -1,19 +1,19 @@ - - {{ params[$i18n.locale].slug }} - + + {{ params[$i18n.locale].slug }} +