1
1
import PropTypes from '../_util/vue-types' ;
2
2
import BaseMixin from '../_util/BaseMixin' ;
3
- import { hasProp , getOptionProps , getComponent } from '../_util/props-util' ;
3
+ import { hasProp , getOptionProps , getComponent , splitAttrs } from '../_util/props-util' ;
4
4
import Pager from './Pager' ;
5
5
import Options from './Options' ;
6
6
import LOCALE from './locale/zh_CN' ;
@@ -30,10 +30,6 @@ export default {
30
30
name : 'Pagination' ,
31
31
mixins : [ BaseMixin ] ,
32
32
inheritAttrs : false ,
33
- model : {
34
- prop : 'current' ,
35
- event : 'change.current' ,
36
- } ,
37
33
props : {
38
34
disabled : PropTypes . bool ,
39
35
prefixCls : PropTypes . string . def ( 'rc-pagination' ) ,
@@ -241,7 +237,7 @@ export default {
241
237
this . $emit ( 'update:pageSize' , size ) ;
242
238
this . $emit ( 'showSizeChange' , current , size ) ;
243
239
if ( current !== preCurrent ) {
244
- this . $emit ( 'change. current' , current , size ) ;
240
+ this . $emit ( 'update: current' , current ) ;
245
241
}
246
242
} ,
247
243
handleChange ( p ) {
@@ -262,7 +258,7 @@ export default {
262
258
}
263
259
// this.$emit('input', page)
264
260
this . $emit ( 'change' , page , this . statePageSize ) ;
265
- this . $emit ( 'change. current' , page , this . statePageSize ) ;
261
+ this . $emit ( 'update: current' , page ) ;
266
262
return page ;
267
263
}
268
264
return this . stateCurrent ;
@@ -314,7 +310,7 @@ export default {
314
310
} ,
315
311
render ( ) {
316
312
const { prefixCls, disabled } = this . $props ;
317
-
313
+ const { class : className , ... restAttrs } = splitAttrs ( this . $attrs ) . extraAttrs ;
318
314
// When hideOnSinglePage is true and there is only 1 page, hide the pager
319
315
if ( this . hideOnSinglePage === true && this . total <= this . statePageSize ) {
320
316
return null ;
@@ -363,7 +359,7 @@ export default {
363
359
const hasNext = this . hasNext ( ) ;
364
360
365
361
return (
366
- < ul class = { classNames ( `${ prefixCls } ${ prefixCls } -simple` , this . $attrs . class ) } >
362
+ < ul class = { classNames ( `${ prefixCls } ${ prefixCls } -simple` , className ) } { ... restAttrs } >
367
363
< li
368
364
title = { this . showTitle ? locale . prev_page : null }
369
365
onClick = { this . prev }
@@ -579,14 +575,16 @@ export default {
579
575
}
580
576
const prevDisabled = ! this . hasPrev ( ) || ! allPages ;
581
577
const nextDisabled = ! this . hasNext ( ) || ! allPages ;
582
- const buildOptionText = this . buildOptionText || this . $slots . buildOptionText ?. ( ) ;
583
- const { class : _cls , style } = this . $attrs ;
578
+ const buildOptionText = this . buildOptionText || this . $slots . buildOptionText ;
584
579
return (
585
580
< ul
586
581
unselectable = "unselectable"
587
582
ref = "paginationNode"
588
- style = { style }
589
- class = { classNames ( { [ `${ prefixCls } ` ] : true , [ `${ prefixCls } -disabled` ] : disabled } , _cls ) }
583
+ { ...restAttrs }
584
+ class = { classNames (
585
+ { [ `${ prefixCls } ` ] : true , [ `${ prefixCls } -disabled` ] : disabled } ,
586
+ className ,
587
+ ) }
590
588
>
591
589
{ totalText }
592
590
< li
0 commit comments