From 11cd974e3876bfda82b6f9e7749b080059602241 Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Thu, 17 Mar 2022 14:58:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E8=B7=B3=E8=BD=AC=E6=96=B9?= =?UTF-8?q?=E5=BC=8F=E6=94=B9=E5=8F=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/next/components/SearchInput.js | 49 +++++++++++++++------------ 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/themes/next/components/SearchInput.js b/themes/next/components/SearchInput.js index c3565c43..09fde988 100644 --- a/themes/next/components/SearchInput.js +++ b/themes/next/components/SearchInput.js @@ -21,10 +21,10 @@ const SearchInput = ({ currentTag, currentSearch, cRef }) => { const key = searchInputRef.current.value if (key && key !== '') { setLoadingState(true) - // router.push({ pathname: '/search/' + key }).then(r => { - // setLoadingState(false) - // }) - location.href = '/search/' + key + router.push({ pathname: '/search/' + key }).then(r => { + setLoadingState(false) + }) + // location.href = '/search/' + key } else { router.push({ pathname: '/' }).then(r => { }) @@ -61,26 +61,31 @@ const SearchInput = ({ currentTag, currentSearch, cRef }) => { } } - return
- updateSearchKey(e.target.value)} - defaultValue={currentSearch} - /> - {(showClean && )} + return
+ updateSearchKey(e.target.value)} + defaultValue={currentSearch || ''} + /> -
- -
+
+
+ + {(showClean && +
+ +
+ )} +
} export default SearchInput