From fc20ea24d4af8f1319ecc25727befad2d1d16505 Mon Sep 17 00:00:00 2001 From: yutent Date: Wed, 27 Dec 2023 15:50:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96router-link=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E6=97=A0=E5=88=9D=E5=A7=8B=E5=80=BC=E7=9A=84=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/router/router-components.js | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 66bd205..3e80e68 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wkitd", - "version": "1.3.3", + "version": "1.3.4", "type": "module", "main": "dist/index.js", "files": [ diff --git a/src/router/router-components.js b/src/router/router-components.js index 2ca7002..666a7fe 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; + gap: var(--router-link-gap, 0); width: 100%; height: 100%; color: inherit; @@ -119,7 +120,6 @@ class RouterLink extends Component { cursor: not-allowed; } ` - #href = '' #navigate() { @@ -144,13 +144,14 @@ class RouterLink extends Component { ? query.replaceAll('?', '') : object2query(query) - path = path.replace(/^\//, '') + path = '/' + path.replace(/^\/+/, '') + this.to = { path, query } if (params) { path += '?' + params } - return '/' + path + return path } activated() {