From 6adfe9c6e9268bf9da8c00915b909e97a6acccdd Mon Sep 17 00:00:00 2001 From: Hakadao Date: Thu, 29 Feb 2024 00:09:57 -0300 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=90=9C=E7=B4=A2=E6=A1=86=E7=94=A8?= =?UTF-8?q?=E4=B8=AD=E6=96=87=E8=BE=93=E5=85=A5=E6=B3=95=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E5=8D=95=E8=AF=8D=E5=9B=9E=E8=BD=A6=E4=B8=8D=E5=BA=94=E8=AF=A5?= =?UTF-8?q?=E7=9B=B4=E6=8E=A5=E8=A7=A6=E5=8F=91=E6=90=9C=E7=B4=A2=20#334?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/SearchBar/SearchBar.vue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/SearchBar/SearchBar.vue b/src/components/SearchBar/SearchBar.vue index 7286d5dd..fe9ade03 100644 --- a/src/components/SearchBar/SearchBar.vue +++ b/src/components/SearchBar/SearchBar.vue @@ -128,6 +128,13 @@ function handleKeyDown() { }) } +function handleKeyEnter(e: KeyboardEvent) { + if (!e.shiftKey && e.key === 'Enter' && !e.isComposing) { + e.preventDefault() + navigateToSearchResultPage(keyword.value) + } +} + async function handleClearSearchHistory() { await clearAllSearchHistory() searchHistory.value = [] @@ -175,7 +182,7 @@ async function handleClearSearchHistory() { type="text" @focus="isFocus = true" @input="handleInput" - @keyup.enter.stop.passive="navigateToSearchResultPage(keyword)" + @keydown.enter.stop.passive="handleKeyEnter" @keyup.up.stop.passive="handleKeyUp" @keyup.down.stop.passive="handleKeyDown" @keydown.stop="() => {}"