1
1
import PropTypes from '../_util/vue-types' ;
2
2
import BaseMixin from '../_util/BaseMixin' ;
3
- import { hasProp , getComponentFromProp , getOptionProps } from '../_util/props-util' ;
3
+ import { hasProp , getOptionProps , getComponent } from '../_util/props-util' ;
4
4
import Pager from './Pager' ;
5
5
import Options from './Options' ;
6
6
import LOCALE from './locale/zh_CN' ;
7
7
import KEYCODE from './KeyCode' ;
8
+ import classNames from 'classnames' ;
8
9
9
10
function noop ( ) { }
10
11
@@ -28,6 +29,7 @@ function calculatePage(p, state, props) {
28
29
export default {
29
30
name : 'Pagination' ,
30
31
mixins : [ BaseMixin ] ,
32
+ inheritAttrs : false ,
31
33
model : {
32
34
prop : 'current' ,
33
35
event : 'change.current' ,
@@ -151,7 +153,7 @@ export default {
151
153
} ,
152
154
getItemIcon ( icon ) {
153
155
const { prefixCls } = this . $props ;
154
- const iconNode = getComponentFromProp ( this , icon , this . $props ) || (
156
+ const iconNode = getComponent ( this , icon , this . $props ) || (
155
157
< a class = { `${ prefixCls } -item-link` } />
156
158
) ;
157
159
return iconNode ;
@@ -359,8 +361,9 @@ export default {
359
361
}
360
362
const hasPrev = this . hasPrev ( ) ;
361
363
const hasNext = this . hasNext ( ) ;
364
+
362
365
return (
363
- < ul class = { `${ prefixCls } ${ prefixCls } -simple` } >
366
+ < ul class = { classNames ( `${ prefixCls } ${ prefixCls } -simple` , this . $attrs . class ) } >
364
367
< li
365
368
title = { this . showTitle ? locale . prev_page : null }
366
369
onClick = { this . prev }
@@ -409,16 +412,12 @@ export default {
409
412
}
410
413
if ( allPages <= 5 + pageBufferSize * 2 ) {
411
414
const pagerProps = {
412
- props : {
413
- locale,
414
- rootPrefixCls : prefixCls ,
415
- showTitle : props . showTitle ,
416
- itemRender : props . itemRender ,
417
- } ,
418
- on : {
419
- click : this . handleChange ,
420
- keypress : this . runIfEnter ,
421
- } ,
415
+ locale,
416
+ rootPrefixCls : prefixCls ,
417
+ showTitle : props . showTitle ,
418
+ itemRender : props . itemRender ,
419
+ onClick : this . handleChange ,
420
+ onKeypress : this . runIfEnter ,
422
421
} ;
423
422
if ( ! allPages ) {
424
423
pagerList . push (
@@ -580,12 +579,14 @@ export default {
580
579
}
581
580
const prevDisabled = ! this . hasPrev ( ) || ! allPages ;
582
581
const nextDisabled = ! this . hasNext ( ) || ! allPages ;
583
- const buildOptionText = this . buildOptionText || this . $scopedSlots . buildOptionText ;
582
+ const buildOptionText = this . buildOptionText || this . $slots . buildOptionText ?. ( ) ;
583
+ const { class : _cls , style } = this . $attrs ;
584
584
return (
585
585
< ul
586
- class = { { [ `${ prefixCls } ` ] : true , [ `${ prefixCls } -disabled` ] : disabled } }
587
586
unselectable = "unselectable"
588
587
ref = "paginationNode"
588
+ style = { style }
589
+ class = { classNames ( { [ `${ prefixCls } ` ] : true , [ `${ prefixCls } -disabled` ] : disabled } , _cls ) }
589
590
>
590
591
{ totalText }
591
592
< li
0 commit comments