ant-design-vue/components/pagination/Pagination.vue

81 lines
1.9 KiB
Vue
Raw Normal View History

2018-01-22 13:27:37 +00:00
<script>
2018-03-05 11:06:44 +00:00
import PropTypes from '../_util/vue-types'
import VcSelect from '../select'
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,
])),
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,
2018-01-22 13:27:37 +00:00
}
export default {
props: {
2018-03-05 11:06:44 +00:00
...PaginationProps,
prefixCls: PropTypes.string.def('ant-pagination'),
selectPrefixCls: PropTypes.string.def('ant-select'),
2018-01-22 13:27:37 +00:00
},
model: {
prop: 'current',
},
data () {
const { current } = this
return {
stateCurrent: +current,
}
},
methods: {
2018-03-05 11:06:44 +00:00
renderPagination (locale) {
const { size, ...restProps } = getOptionProps(this)
const isSmall = size === 'small'
const paginationProps = {
props: {
...restProps,
selectComponentClass: VcSelect,
locale,
},
class: {
'mini': isSmall,
},
on: this.$listeners,
2018-01-22 13:27:37 +00:00
}
return (
2018-03-05 11:06:44 +00:00
<VcPagination
{...paginationProps}
2018-01-22 13:27:37 +00:00
/>
)
2018-03-05 11:06:44 +00:00
},
},
render () {
2018-01-22 13:27:37 +00:00
return (
2018-03-05 11:06:44 +00:00
<LocaleReceiver
componentName='Pagination'
defaultLocale={enUS}
children={this.renderPagination}
/>
2018-01-22 13:27:37 +00:00
)
},
}
</script>