File tree 2 files changed +16
-3
lines changed
2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -13,15 +13,19 @@ class PageButton extends React.Component{
13
13
}
14
14
15
15
render ( ) {
16
- var classes = this . props . active ?classSet ( "active" ) :null ;
16
+ var classes = classSet ( {
17
+ 'active' : this . props . active ,
18
+ 'disabled' : this . props . disable
19
+ } ) ;
17
20
return (
18
21
< li className = { classes } > < a href = "#" onClick = { this . pageBtnClick . bind ( this ) } > { this . props . children } </ a > </ li >
19
22
)
20
23
}
21
24
}
22
25
PageButton . propTypes = {
23
26
changePage : React . PropTypes . func ,
24
- active : React . PropTypes . bool
27
+ active : React . PropTypes . bool ,
28
+ disable : React . PropTypes . bool
25
29
} ;
26
30
27
31
export default PageButton ;
Original file line number Diff line number Diff line change @@ -109,8 +109,17 @@ class PaginationList extends React.Component {
109
109
var pages = this . getPages ( ) ;
110
110
return pages . map ( function ( page ) {
111
111
var isActive = page === this . state . currentPage ;
112
+ var disabled = false ;
113
+ if ( this . state . currentPage == 1 &&
114
+ ( page === Const . FIRST_PAGE || page === Const . PRE_PAGE ) ) {
115
+ disabled = true ;
116
+ }
117
+ if ( this . state . currentPage == this . totalPages &&
118
+ ( page === Const . NEXT_PAGE || page === Const . LAST_PAGE ) ) {
119
+ disabled = true ;
120
+ }
112
121
return (
113
- < PageButton changePage = { this . changePage . bind ( this ) } active = { isActive } key = { page } > { page } </ PageButton >
122
+ < PageButton changePage = { this . changePage . bind ( this ) } active = { isActive } disable = { disabled } key = { page } > { page } </ PageButton >
114
123
)
115
124
} , this ) ;
116
125
}
You can’t perform that action at this time.
0 commit comments