搜索关键词默认值

This commit is contained in:
周炽键 2021-07-27 16:39:14 +08:00
parent e8317fd749
commit 5817d0d9af
1 changed files with 3 additions and 2 deletions

View File

@ -26,7 +26,7 @@ export default function RepositoryList (props:RepositoryListProps) {
useContext(RepositorySearchContext) useContext(RepositorySearchContext)
/** 搜索关键词 */ /** 搜索关键词 */
const [keyword, setKeyword] = useState(props.keyword) const [keyword, setKeyword] = useState('')
const cache = RepositorySearchCache(keyword, props.max_cache_page) const cache = RepositorySearchCache(keyword, props.max_cache_page)
@ -88,7 +88,8 @@ export default function RepositoryList (props:RepositoryListProps) {
} }
useEffect(() => { useEffect(() => {
search(keyword,1) setKeyword(props.keyword)
search(props.keyword,1)
}, []) }, [])
function onClickPrev(){ function onClickPrev(){