From 9163e48589d8b99af425cec532b8836e721db3be Mon Sep 17 00:00:00 2001 From: Clark Du Date: Sat, 2 Dec 2017 21:45:55 +0800 Subject: [PATCH] fix: generate pages/index/** --- lib/common/utils.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/common/utils.js b/lib/common/utils.js index 7e534cf62a..71aba7a4a7 100644 --- a/lib/common/utils.js +++ b/lib/common/utils.js @@ -150,8 +150,12 @@ export function flatRoutes(router, path = '', routes = []) { if (!r.path.includes(':') && !r.path.includes('*')) { /* istanbul ignore if */ if (r.children) { + if (path === '' && r.path === '/') { + routes.push('/') + } flatRoutes(r.children, path + r.path + '/', routes) } else { + path = path.replace(/^\/+$/, '/') routes.push((r.path === '' && path[path.length - 1] === '/' ? path.slice(0, -1) : path) + r.path) } }