From 51ace5fbd7a345a077f6157058bb0fa8c511f9ce Mon Sep 17 00:00:00 2001 From: YunYouJun Date: Sun, 5 Feb 2023 00:30:51 +0800 Subject: [PATCH 1/3] fix: extra .html generated when vite-ssg dirStyles flat --- src/RouteLayout.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/RouteLayout.ts b/src/RouteLayout.ts index 8eb601f..b2f877e 100644 --- a/src/RouteLayout.ts +++ b/src/RouteLayout.ts @@ -6,11 +6,12 @@ ${importCode} export function setupLayouts(routes) { return routes.map(route => { - return { + const destRoute = { path: route.path, component: layouts[route.meta?.layout || '${options.defaultLayout}'], - children: [ {...route, path: ''} ], } + if (route.path !== '/') destRoute.children = [ {...route, path: ''} ] + return destRoute }) } ` From be266add65e03fab4d8af61aadfcb8336cfc276b Mon Sep 17 00:00:00 2001 From: YunYouJun Date: Sun, 5 Feb 2023 03:18:53 +0800 Subject: [PATCH 2/3] 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 }) } ` From ba8c2a8a91830208ef50266c13e7c3d9ff1758b5 Mon Sep 17 00:00:00 2001 From: YunYouJun Date: Sun, 5 Feb 2023 03:19:47 +0800 Subject: [PATCH 3/3] chore: remove useless } --- src/RouteLayout.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/RouteLayout.ts b/src/RouteLayout.ts index df55c32..5df251d 100644 --- a/src/RouteLayout.ts +++ b/src/RouteLayout.ts @@ -9,7 +9,7 @@ export function setupLayouts(routes) { return { path: route.path, component: layouts[route.meta?.layout || '${options.defaultLayout}'], - children: route.path === '/' ? [route] : [{...route, path: ''}]} + children: route.path === '/' ? [route] : [{...route, path: ''}] } }) }