You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
2.0 KiB
79 lines
2.0 KiB
7 years ago
|
|
||
7 years ago
|
import PropTypes from '../_util/vue-types'
|
||
|
import VcSelect from '../select'
|
||
7 years ago
|
import MiniSelect from './MiniSelect'
|
||
7 years ago
|
import enUS from '../vc-pagination/locale/en_US'
|
||
|
import LocaleReceiver from '../locale-provider/LocaleReceiver'
|
||
|
import { getOptionProps } from '../_util/props-util'
|
||
|
import VcPagination from '../vc-pagination'
|
||
|
|
||
|
export const PaginationProps = {
|
||
|
total: PropTypes.number,
|
||
|
defaultCurrent: PropTypes.number,
|
||
|
current: PropTypes.number,
|
||
|
defaultPageSize: PropTypes.number,
|
||
|
pageSize: PropTypes.number,
|
||
|
hideOnSinglePage: PropTypes.bool,
|
||
|
showSizeChanger: PropTypes.bool,
|
||
|
pageSizeOptions: PropTypes.arrayOf(PropTypes.oneOfType([
|
||
|
PropTypes.number,
|
||
|
PropTypes.string,
|
||
|
])),
|
||
7 years ago
|
buildOptionText: PropTypes.func,
|
||
7 years ago
|
showSizeChange: PropTypes.func,
|
||
|
showQuickJumper: PropTypes.bool,
|
||
|
showTotal: PropTypes.any,
|
||
|
size: PropTypes.string,
|
||
|
simple: PropTypes.bool,
|
||
|
locale: PropTypes.object,
|
||
|
prefixCls: PropTypes.string,
|
||
|
selectPrefixCls: PropTypes.string,
|
||
|
itemRender: PropTypes.any,
|
||
7 years ago
|
}
|
||
|
|
||
|
export default {
|
||
|
props: {
|
||
7 years ago
|
...PaginationProps,
|
||
|
prefixCls: PropTypes.string.def('ant-pagination'),
|
||
|
selectPrefixCls: PropTypes.string.def('ant-select'),
|
||
7 years ago
|
},
|
||
|
model: {
|
||
|
prop: 'current',
|
||
7 years ago
|
event: 'change',
|
||
7 years ago
|
},
|
||
|
methods: {
|
||
7 years ago
|
renderPagination (locale) {
|
||
7 years ago
|
const { buildOptionText, size, ...restProps } = getOptionProps(this)
|
||
7 years ago
|
const isSmall = size === 'small'
|
||
|
const paginationProps = {
|
||
|
props: {
|
||
|
...restProps,
|
||
7 years ago
|
selectComponentClass: (isSmall ? MiniSelect : VcSelect),
|
||
7 years ago
|
locale,
|
||
7 years ago
|
buildOptionText: buildOptionText || this.$scopedSlots.buildOptionText,
|
||
7 years ago
|
},
|
||
|
class: {
|
||
|
'mini': isSmall,
|
||
|
},
|
||
|
on: this.$listeners,
|
||
7 years ago
|
}
|
||
|
|
||
|
return (
|
||
7 years ago
|
<VcPagination
|
||
|
{...paginationProps}
|
||
7 years ago
|
/>
|
||
|
)
|
||
7 years ago
|
},
|
||
|
},
|
||
|
render () {
|
||
7 years ago
|
return (
|
||
7 years ago
|
<LocaleReceiver
|
||
|
componentName='Pagination'
|
||
|
defaultLocale={enUS}
|
||
|
children={this.renderPagination}
|
||
|
/>
|
||
7 years ago
|
)
|
||
|
},
|
||
|
}
|
||
7 years ago
|
|