pagination .vue 869 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <template>
  2. <el-pagination
  3. class="pagination"
  4. @size-change="handleSizeChange"
  5. @current-change="handleCurrentChange"
  6. :current-page="page"
  7. :page-sizes="[10,20,50,100]"
  8. :page-size="size"
  9. layout="total, sizes, prev, pager, next, jumper"
  10. :total="total">
  11. </el-pagination>
  12. </template>
  13. <script>
  14. export default {
  15. props: {
  16. total: { type: Number, default: 0 }
  17. },
  18. data () {
  19. return {
  20. page: 0,
  21. size: 10
  22. }
  23. },
  24. methods: {
  25. handleSizeChange (val) {
  26. this.size = val
  27. this.handleChange()
  28. },
  29. handleCurrentChange (val) {
  30. this.page = val
  31. this.handleChange()
  32. },
  33. handleChange () {
  34. this.$emit('handlechange', { page: this.page, size: this.size })
  35. }
  36. },
  37. mounted () {}
  38. }
  39. </script>
  40. <style lang="less" scoped>
  41. .pagination {
  42. margin-left: 1%;
  43. margin-top: 20px;
  44. }
  45. </style>