清除不必要的状态
This commit is contained in:
parent
8077d249f6
commit
7ad342217e
|
@ -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>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue