From a9ff9f032360504ef73c7ef80b4ad0605c21d368 Mon Sep 17 00:00:00 2001 From: yutent Date: Wed, 15 May 2024 15:31:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=B7=AF=E7=94=B1,=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E9=A6=96=E9=A1=B5=E5=B8=A6index.html=E8=AE=BF?= =?UTF-8?q?=E9=97=AE;=20=E4=BC=98=E5=8C=96router-link=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/router/router-components.js | 1 + src/router/router-engine.js | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 6f2f87d..c0ae27a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wkitd", - "version": "1.3.9", + "version": "1.3.10", "type": "module", "main": "dist/index.js", "files": [ diff --git a/src/router/router-components.js b/src/router/router-components.js index 93d59e4..790507a 100644 --- a/src/router/router-components.js +++ b/src/router/router-components.js @@ -107,6 +107,7 @@ class RouterLink extends Component { a { display: flex; align-items: center; + justify-content: center; gap: var(--router-link-gap, 0); width: 100%; height: 100%; diff --git a/src/router/router-engine.js b/src/router/router-engine.js index c3bab17..b6074f5 100644 --- a/src/router/router-engine.js +++ b/src/router/router-engine.js @@ -106,6 +106,10 @@ class Router { ;[path, query] = path.split('?') } path = path.replace(PREFIX_REGEXP, '/') + // 修正默认主页,以支持带路径访问的首页 + if (path === '/index.html') { + path = '/' + } if (!$view || path === this.#route.path) { // query不同, 只更新query