myPagination.vue 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <!--
  2. props:{
  3. size: 当前页的页数,
  4. sizes: 下拉的条数,
  5. total: 总条数,
  6. currentPage: 当前页
  7. }
  8. @change 发生改变
  9. -->
  10. <template>
  11. <div class="block">
  12. <el-pagination
  13. @size-change="handleSizeChange"
  14. @current-change="handleCurrentChange"
  15. :current-page.sync="page.currentPage"
  16. :page-sizes="page.sizes"
  17. :page-size="page.size"
  18. :small="true"
  19. :layout=" isSmall ? 'total, sizes, prev, pager, next, jumper' : 'prev, pager, next'"
  20. :total="page.total">
  21. </el-pagination>
  22. </div>
  23. </template>
  24. <script>
  25. export default {
  26. name: "pagination",
  27. props: {
  28. page: {
  29. type: Object
  30. },
  31. isSmall:{
  32. type:Boolean,
  33. default: true
  34. }
  35. },
  36. methods: {
  37. //当前条数发生改变
  38. handleSizeChange(val) {
  39. this.page.size = val;
  40. this.change()
  41. },
  42. //当前页发生改变
  43. handleCurrentChange(val) {
  44. this.page.currentPage = val;
  45. this.change()
  46. },
  47. //发生改变
  48. change() {
  49. this.$emit("change");
  50. }
  51. }
  52. };
  53. </script>
  54. <style>
  55. .block{
  56. margin-top: 5px;
  57. }
  58. </style>