78a858c01016471f78ff7740ae0a6d6ce2c44b17.svn-base 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <template>
  2. <div :class="boxClass">
  3. <a-pagination
  4. :disabled="disabled"
  5. v-bind="bindProps"
  6. @change="handleChange"
  7. @showSizeChange="handleShowSizeChange"
  8. />
  9. </div>
  10. </template>
  11. <script>
  12. import PropTypes from 'ant-design-vue/es/_util/vue-types'
  13. export default {
  14. name: 'JVxePagination',
  15. props: {
  16. size: String,
  17. disabled: PropTypes.bool,
  18. pagination: PropTypes.object.def({}),
  19. },
  20. data() {
  21. return {
  22. defaultPagination: {
  23. current: 1,
  24. pageSize: 10,
  25. pageSizeOptions: ['10', '20', '30'],
  26. showTotal: (total, range) => {
  27. return range[0] + '-' + range[1] + ' 共 ' + total + ' 条'
  28. },
  29. showQuickJumper: true,
  30. showSizeChanger: true,
  31. total: 100
  32. }
  33. }
  34. },
  35. computed: {
  36. bindProps() {
  37. return {
  38. ...this.defaultPagination,
  39. ...this.pagination,
  40. size: this.size === 'tiny' ? 'small' : ''
  41. }
  42. },
  43. boxClass() {
  44. return {
  45. 'j-vxe-pagination': true,
  46. 'show-quick-jumper': !!this.bindProps.showQuickJumper
  47. }
  48. },
  49. },
  50. methods: {
  51. handleChange(current, pageSize) {
  52. this.$set(this.pagination, 'current', current)
  53. this.$emit('change', {current, pageSize})
  54. },
  55. handleShowSizeChange(current, pageSize) {
  56. this.$set(this.pagination, 'pageSize', pageSize)
  57. this.$emit('change', {current, pageSize})
  58. },
  59. },
  60. }
  61. </script>
  62. <style lang="less" scoped>
  63. </style>