page.vue 949 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <template>
  2. <div class="page-wrap">
  3. <el-pagination
  4. background
  5. :current-page.sync="currentPage"
  6. :page-size="pageSize"
  7. layout="prev, pager, next"
  8. :total="total"
  9. @current-change="handleCurrentChange">
  10. </el-pagination>
  11. </div>
  12. </template>
  13. <script>
  14. export default {
  15. data () {
  16. return {
  17. nowPage: 1,
  18. currentPage: 1
  19. }
  20. },
  21. watch: {
  22. current: function () {
  23. this.nowPage = Number(this.current)
  24. this.currentPage = this.nowPage
  25. }
  26. },
  27. props: ['current', 'total', 'pageSize'],
  28. methods: {
  29. handleCurrentChange: function (changedPage) {
  30. if (this.nowPage !== this.currentPage) {
  31. this.$emit('childEvent', changedPage)
  32. }
  33. }
  34. }
  35. }
  36. </script>
  37. <style type="text/scss" lang="scss" scoped>
  38. .page-wrap{
  39. text-align: center;
  40. padding-top:25px;
  41. .el-pagination{
  42. height:30px;
  43. }
  44. }
  45. </style>