PaginationPage.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <el-pagination
  3. background
  4. :current-page="cur_page"
  5. :page-sizes="[10, 20, 30, 40, 50]"
  6. :page-size="page_capacity"
  7. :pager-count="pagerCount"
  8. layout="total, prev, pager, next, sizes, jumper"
  9. :total="total"
  10. @prev-click="changePage"
  11. @next-click="changePage"
  12. @current-change="changePage"
  13. @size-change="changePageSize"
  14. />
  15. </template>
  16. <script>
  17. export default {
  18. name: 'PaginationPage',
  19. props: {
  20. pageSize: {
  21. type: Number,
  22. default: 10,
  23. },
  24. total: {
  25. type: Number,
  26. required: true,
  27. },
  28. pagerCount: {
  29. type: Number,
  30. default: 7,
  31. },
  32. },
  33. data() {
  34. return {
  35. cur_page: 1,
  36. page_capacity: this.pageSize,
  37. };
  38. },
  39. created() {
  40. this.getList();
  41. },
  42. methods: {
  43. changePage(number) {
  44. this.cur_page = number;
  45. this.getList();
  46. },
  47. changePageSize(size) {
  48. this.page_capacity = size;
  49. this.getList();
  50. },
  51. getList() {
  52. this.$emit('getList', { cur_page: this.cur_page, page_capacity: this.page_capacity });
  53. },
  54. },
  55. };
  56. </script>