File tree 2 files changed +7
-16
lines changed
2 files changed +7
-16
lines changed Original file line number Diff line number Diff line change 45
45
},
46
46
"dependencies" : {
47
47
"@babel/runtime" : " ^7.10.1" ,
48
- "classnames" : " ^2.2.1"
48
+ "classnames" : " ^2.2.1" ,
49
+ "rc-util" : " ^5.32.2"
49
50
},
50
51
"devDependencies" : {
51
52
"@types/classnames" : " ^2.2.9" ,
Original file line number Diff line number Diff line change 1
- /* eslint react/prop-types: 0 */
2
1
import classNames from 'classnames' ;
2
+ import pickAttrs from 'rc-util/lib/pickAttrs' ;
3
3
import React , { cloneElement , isValidElement } from 'react' ;
4
4
import KEYCODE from './KeyCode' ;
5
5
import LOCALE from './locale/zh_CN' ;
@@ -486,20 +486,10 @@ class Pagination extends React.Component<PaginationProps, PaginationState> {
486
486
const prevPage = current - 1 > 0 ? current - 1 : 0 ;
487
487
const nextPage = current + 1 < allPages ? current + 1 : allPages ;
488
488
489
- const dataOrAriaAttributeProps = Object . keys ( this . props ) . reduce (
490
- ( prev , key ) => {
491
- if (
492
- key . substr ( 0 , 5 ) === 'data-' ||
493
- key . substr ( 0 , 5 ) === 'aria-' ||
494
- key === 'role'
495
- ) {
496
- // eslint-disable-next-line no-param-reassign
497
- prev [ key ] = this . props [ key ] ;
498
- }
499
- return prev ;
500
- } ,
501
- { } ,
502
- ) ;
489
+ const dataOrAriaAttributeProps = pickAttrs ( this . props , {
490
+ aria : true ,
491
+ data : true ,
492
+ } ) ;
503
493
504
494
const totalText = showTotal && (
505
495
< li className = { `${ prefixCls } -total-text` } >
You can’t perform that action at this time.
0 commit comments