PaginationPage.vue 999 B

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