From c1c72c9bd5a04ddcf3416fc46ed2531aa56cb726 Mon Sep 17 00:00:00 2001 From: jaywcjlove Date: Tue, 22 Nov 2022 01:36:27 +0000 Subject: [PATCH] website: fix search page turning error. #32 13a6f7f4d506edcf8d12de79637d82985782684e --- index.html | 2 +- js/main.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 4ece93ec..c8ffcb4c 100644 --- a/index.html +++ b/index.html @@ -692,7 +692,7 @@

如果你有资源,可以很方便部署 web 版,这非常简单,只需要克隆 gh-pages 分支代码到你的静态服务就可以了,还可以使用 docker 快捷部署 web 版。

-
+
diff --git a/js/main.js b/js/main.js index 8d5b045c..c0dd32e6 100644 --- a/js/main.js +++ b/js/main.js @@ -78,7 +78,8 @@ document.addEventListener('keydown', (ev) => { searchBox.classList.contains('show') ? hideSearch() : showSearch(); } if (ev.key.toLocaleLowerCase() === 'enter') { - window.location.href = getDocUrl(activeMenu.path) + const url = activeMenu.path || activeMenu?.item.path; + window.location.href = getDocUrl(url); } if (ev.key.toLocaleLowerCase() === 'arrowdown') { activeAnchorElm('down')