From be266add65e03fab4d8af61aadfcb8336cfc276b Mon Sep 17 00:00:00 2001 From: YunYouJun Date: Sun, 5 Feb 2023 03:18:53 +0800 Subject: [PATCH] chore: judge set path by route.path --- src/RouteLayout.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/RouteLayout.ts b/src/RouteLayout.ts index b2f877e..df55c32 100644 --- a/src/RouteLayout.ts +++ b/src/RouteLayout.ts @@ -6,12 +6,11 @@ ${importCode} export function setupLayouts(routes) { return routes.map(route => { - const destRoute = { + return { path: route.path, component: layouts[route.meta?.layout || '${options.defaultLayout}'], + children: route.path === '/' ? [route] : [{...route, path: ''}]} } - if (route.path !== '/') destRoute.children = [ {...route, path: ''} ] - return destRoute }) } `