清除不必要的状态

This commit is contained in:
周炽键 2021-07-27 14:37:03 +08:00
parent 8077d249f6
commit 7ad342217e
2 changed files with 1968 additions and 2011 deletions

View File

@ -29,12 +29,6 @@ export default function RepositoryList (props:RepositoryListProps) {
/** 总页码 */ /** 总页码 */
const [total_page, setTotalPage] = useState(0) const [total_page, setTotalPage] = useState(0)
/** 上一页按钮是否可点击 */
const [prev_button_enable, setPrevButtonEnable] = useState(false)
/** 下一页按钮是否可点击 */
const [next_button_enable, setNextButtonEnable] = useState(false)
/** 接口加载中 */ /** 接口加载中 */
const [loading, setLoading] = useState(false) const [loading, setLoading] = useState(false)
@ -77,10 +71,6 @@ export default function RepositoryList (props:RepositoryListProps) {
cache.updateTotalPage(_total_page) cache.updateTotalPage(_total_page)
} }
setPrevButtonEnable(page>1)
setNextButtonEnable(page<_total_page)
setTotalPage(_total_page) setTotalPage(_total_page)
setCurrentPage(page) setCurrentPage(page)
@ -118,8 +108,8 @@ export default function RepositoryList (props:RepositoryListProps) {
</div> </div>
<div className="action-bar"> <div className="action-bar">
<button disabled={loading || !prev_button_enable} onClick={onClickPrev}></button> <button disabled={loading || current_page<=1} onClick={onClickPrev}></button>
<button disabled={loading || !next_button_enable} onClick={onClickNext}></button> <button disabled={loading || current_page>=total_page} onClick={onClickNext}></button>
<span> {current_page} / {total_page}</span> <span> {current_page} / {total_page}</span>
</div> </div>

3965
yarn.lock

File diff suppressed because it is too large Load Diff