Update main.js
This commit is contained in:
parent
d76f7c8eca
commit
c6880530ef
|
@ -81,12 +81,16 @@ import _ from "lodash";
|
||||||
this.props.onNextClick(page_num);
|
this.props.onNextClick(page_num);
|
||||||
}
|
}
|
||||||
onPageClick(e){
|
onPageClick(e){
|
||||||
|
console.log(e)
|
||||||
|
if(e=="…")
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({page:e})
|
this.setState({page:e})
|
||||||
this.props.onJumpPage(e)
|
this.props.onJumpPage(e)
|
||||||
}
|
}
|
||||||
onInputChange(e,page_num){
|
onInputChange(e,page_num){
|
||||||
console.log("当前页码变化")
|
|
||||||
|
|
||||||
|
|
||||||
let jump = e.target.value > page_num ? page_num : e.target.value;
|
let jump = e.target.value > page_num ? page_num : e.target.value;
|
||||||
this.setState({jump_page:jump})
|
this.setState({jump_page:jump})
|
||||||
|
@ -139,6 +143,8 @@ import _ from "lodash";
|
||||||
btnPages.push(o);
|
btnPages.push(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
let btns = this.getPageArr(btnPages,this.state.page,5)
|
||||||
return (
|
return (
|
||||||
<div className="pagination">
|
<div className="pagination">
|
||||||
<div className="pagination-context">
|
<div className="pagination-context">
|
||||||
|
@ -166,9 +172,9 @@ import _ from "lodash";
|
||||||
<div className="page-btn-group">
|
<div className="page-btn-group">
|
||||||
<Icon onClick={()=>{this.onPrevClick()}} type={"left"} className={ this.state.page > 1 ? "page-prev" :"page-prev disabled" } />
|
<Icon onClick={()=>{this.onPrevClick()}} type={"left"} className={ this.state.page > 1 ? "page-prev" :"page-prev disabled" } />
|
||||||
{
|
{
|
||||||
btnPages.map((item, index) => {
|
btns.map((item, index) => {
|
||||||
return (
|
return (
|
||||||
<div onClick={()=>{this.onPageClick(item.page)}} key={index} className={ item.page == this.state.page ? "btn-page active":"btn-page"}>{item.text}</div>
|
<div onClick={()=>{this.onPageClick(item)}} key={index} className={ item== this.state.page ? "btn-page active":"btn-page"}>{item}</div>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue