From c6880530efd4a484c7b3d526ac7898f273ada851 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8C=97=E6=B5=B7=E4=B8=80=E5=88=80?= <849005670@qq.com> Date: Thu, 18 Nov 2021 09:45:51 +0800 Subject: [PATCH] Update main.js --- src/components/pagination/main.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/components/pagination/main.js b/src/components/pagination/main.js index 817f6ca7..97c78e04 100644 --- a/src/components/pagination/main.js +++ b/src/components/pagination/main.js @@ -81,13 +81,17 @@ import _ from "lodash"; this.props.onNextClick(page_num); } onPageClick(e){ + console.log(e) + if(e=="…") + { + return; + } + this.setState({page:e}) this.props.onJumpPage(e) } onInputChange(e,page_num){ - console.log("当前页码变化") - let jump = e.target.value > page_num ? page_num : e.target.value; this.setState({jump_page:jump}) } @@ -139,6 +143,8 @@ import _ from "lodash"; btnPages.push(o); } + + let btns = this.getPageArr(btnPages,this.state.page,5) return (
@@ -166,9 +172,9 @@ import _ from "lodash";
{this.onPrevClick()}} type={"left"} className={ this.state.page > 1 ? "page-prev" :"page-prev disabled" } /> { - btnPages.map((item, index) => { + btns.map((item, index) => { return ( -
{this.onPageClick(item.page)}} key={index} className={ item.page == this.state.page ? "btn-page active":"btn-page"}>{item.text}
+
{this.onPageClick(item)}} key={index} className={ item== this.state.page ? "btn-page active":"btn-page"}>{item}
) }) }