)
}
diff --git a/themes/hexo/components/JumpToTopButton.js b/themes/hexo/components/JumpToTopButton.js
index de1bce3d..427ef500 100644
--- a/themes/hexo/components/JumpToTopButton.js
+++ b/themes/hexo/components/JumpToTopButton.js
@@ -15,7 +15,7 @@ const JumpToTopButton = ({ showPercent = true, percent }) => {
return <>>
}
const { locale } = useGlobal()
- return (
window.scrollTo({ top: 0, behavior: 'smooth' })} >
+ return (
window.scrollTo({ top: 0, behavior: 'smooth' })} >
{showPercent && (
{percent}
)}
)
diff --git a/themes/hexo/components/PaginationNumber.js b/themes/hexo/components/PaginationNumber.js
index 56942531..45d9282b 100644
--- a/themes/hexo/components/PaginationNumber.js
+++ b/themes/hexo/components/PaginationNumber.js
@@ -37,7 +37,7 @@ const PaginationNumber = ({ page, totalPage }) => {
@@ -48,7 +48,7 @@ const PaginationNumber = ({ page, totalPage }) => {
function getPageElement (page, currentPage) {
return
-
{page}
diff --git a/themes/hexo/components/SearchInput.js b/themes/hexo/components/SearchInput.js
index 438920f7..0f29a3a7 100644
--- a/themes/hexo/components/SearchInput.js
+++ b/themes/hexo/components/SearchInput.js
@@ -1,12 +1,14 @@
import { useRouter } from 'next/router'
import { useImperativeHandle, useRef, useState } from 'react'
+import { useGlobal } from '@/lib/global'
let lock = false
-const SearchInput = (props) => {
+const SearchInput = props => {
const { currentSearch, cRef, className } = props
const [onLoading, setLoadingState] = useState(false)
const router = useRouter()
const searchInputRef = useRef()
+ const { locale } = useGlobal()
useImperativeHandle(cRef, () => {
return {
focus: () => {
@@ -21,14 +23,15 @@ const SearchInput = (props) => {
setLoadingState(true)
location.href = '/search/' + key
} else {
- router.push({ pathname: '/' }).then(r => {
- })
+ router.push({ pathname: '/' }).then(r => {})
}
}
- const handleKeyUp = (e) => {
- if (e.keyCode === 13) { // 回车
+ const handleKeyUp = e => {
+ if (e.keyCode === 13) {
+ // 回车
handleSearch(searchInputRef.current.value)
- } else if (e.keyCode === 27) { // ESC
+ } else if (e.keyCode === 27) {
+ // ESC
cleanSearch()
}
}
@@ -37,7 +40,7 @@ const SearchInput = (props) => {
}
const [showClean, setShowClean] = useState(false)
- const updateSearchKey = (val) => {
+ const updateSearchKey = val => {
if (lock) {
return
}
@@ -57,30 +60,44 @@ const SearchInput = (props) => {
lock = false
}
- return
-
updateSearchKey(e.target.value)}
- defaultValue={currentSearch}
- />
+ return (
+
+
updateSearchKey(e.target.value)}
+ defaultValue={currentSearch || ''}
+ />
-
-
-
-
- {(showClean &&
-
-
+
+
+
+ {showClean && (
+
+
+
)}
-
+
+ )
}
export default SearchInput
diff --git a/themes/hexo/components/TocDrawerButton.js b/themes/hexo/components/TocDrawerButton.js
index a4bba1a4..144af536 100644
--- a/themes/hexo/components/TocDrawerButton.js
+++ b/themes/hexo/components/TocDrawerButton.js
@@ -14,7 +14,7 @@ const TocDrawerButton = (props) => {
return <>>
}
const { locale } = useGlobal()
- return (
+ return (
)
}
diff --git a/themes/next/components/SearchDrawer.js b/themes/next/components/SearchDrawer.js
index c7ec88a7..6c1f46b9 100644
--- a/themes/next/components/SearchDrawer.js
+++ b/themes/next/components/SearchDrawer.js
@@ -28,7 +28,7 @@ const SearchDrawer = ({ cRef, slot }) => {
{/* 背景蒙版 */}
-
+
)
}