pagination.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <div class="card_input">
  3. <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
  4. :page-sizes="pageSizes" :pager-count="pagerCountnum" :layout="layout" :total="total">
  5. </el-pagination>
  6. </div>
  7. </template>
  8. <script>
  9. export default {
  10. name: "pagination",
  11. props: {
  12. currentPage: {
  13. type: Number,
  14. default: 1,
  15. },
  16. total: {
  17. type: Number,
  18. default: 0,
  19. },
  20. pagerCountnum: {
  21. type: Number,
  22. default: 7,
  23. },
  24. layout: {
  25. type: String,
  26. default: 'total, sizes, prev, pager, next,jumper',
  27. },
  28. pageSizes: {
  29. type: Array,
  30. default: () => {
  31. return [10, 20, 30, 40]
  32. },
  33. },
  34. },
  35. data() {
  36. return {
  37. }
  38. },
  39. methods: {
  40. handleSizeChange(val) {
  41. // console.log(`每页 ${val} 条`);
  42. this.$emit('changeSize', val)
  43. },
  44. handleCurrentChange(val) {
  45. // console.log(`当前页: ${val}`);
  46. this.$emit('changeCurrent', val)
  47. }
  48. }
  49. }
  50. </script>
  51. <style scoped lang="scss">
  52. .card_input {
  53. display: flex;
  54. justify-content: flex-end;
  55. padding: 10px;
  56. }
  57. </style>