From 7cac3c7fc95365c53714ecdecd738148b7936e97 Mon Sep 17 00:00:00 2001 From: Ahad Birang Date: Tue, 1 Dec 2020 01:38:33 +0330 Subject: [PATCH] fix(vue-router): force chidren to be required if default child is present (#8394) --- packages/utils/src/route.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/utils/src/route.js b/packages/utils/src/route.js index 9a2c88546f..c4d106fb5a 100644 --- a/packages/utils/src/route.js +++ b/packages/utils/src/route.js @@ -87,6 +87,13 @@ function cleanChildrenRoutes (routes, isChild = false, routeNameSplitter = '-', if (trailingSlash === false) { defaultChildRoute.name = route.name } + route.children.forEach((child) => { + if (child.path !== indexRoutePath) { + const parts = child.path.split('/') + parts[1] = parts[1].endsWith('?') ? parts[1].substr(0, parts[1].length - 1) : parts[1] + child.path = parts.join('/') + } + }) delete route.name } route.children = cleanChildrenRoutes(route.children, true, routeNameSplitter, trailingSlash, routeName)