From e344402ae92fc9d6c5d9536981d7a5cc44c46797 Mon Sep 17 00:00:00 2001 From: zjwmiao <1723168479@qq.com> Date: Thu, 27 Feb 2025 17:46:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=90=9C=E7=B4=A2=E9=A1=B5=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E6=A1=86=E8=BE=93=E5=85=A5=E5=86=85=E5=AE=B9=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E6=9C=AA=E4=B8=8A=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/search/SearchFilter.vue | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/components/search/SearchFilter.vue b/src/components/search/SearchFilter.vue index 0323e42..1c675b3 100644 --- a/src/components/search/SearchFilter.vue +++ b/src/components/search/SearchFilter.vue @@ -108,22 +108,17 @@ const clickRecommend = (v: string) => { }; const isFocus = ref(false); +let focusInput: string | null; const changeSearchFocus = (state: boolean) => { isFocus.value = state; + focusInput = searchInput.value; reportAnalytics({ type: 'search_input', }); }; const changeSearchBlur = () => { - const name = route.query.name as string; - if (isPageSearch.value) { - if (searchInput.value === '' || name !== searchInput.value) { - searchInput.value = name; - } - return; - } - if (searchInput.value) { + if (searchInput.value && focusInput !== searchInput.value) { reportAnalytics( { content: searchInput.value, @@ -131,6 +126,13 @@ const changeSearchBlur = () => { 'input' ); } + focusInput = null; + const name = route.query.name as string; + if (isPageSearch.value) { + if (searchInput.value === '' || name !== searchInput.value) { + searchInput.value = name; + } + } }; onClickOutside(searchRef, () => { -- Gitee