pageComponent.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <div class="page-wrap" v-if="total/1.0/pageSize>1">
  3. <el-pagination
  4. :current-page.sync="currentPage"
  5. :page-size="pageSize"
  6. layout="prev, pager, next"
  7. :total="total"
  8. prev-text="上一页"
  9. next-text="下一页"
  10. @current-change="handleCurrentChange">
  11. </el-pagination>
  12. </div>
  13. </template>
  14. <script>
  15. export default {
  16. data () {
  17. return {
  18. nowPage: 1,
  19. currentPage: 1
  20. }
  21. },
  22. watch: {
  23. current: function () {
  24. this.nowPage = Number(this.current)
  25. this.currentPage = this.nowPage
  26. }
  27. },
  28. props: ['current', 'total', 'pageSize'],
  29. methods: {
  30. handleCurrentChange: function (changedPage) {
  31. if (this.nowPage !== this.currentPage) {
  32. this.$emit('childEvent', changedPage)
  33. }
  34. }
  35. }
  36. }
  37. </script>
  38. <style>
  39. .page-wrap a {
  40. color: #333;
  41. background: 0 0;
  42. text-decoration: none;
  43. outline: 0;
  44. cursor: pointer;
  45. transition: color .2s ease;
  46. }
  47. .el-pagination {
  48. padding: 0;
  49. }
  50. .el-pagination .btn-next {
  51. border-top-right-radius: 4px;
  52. border-bottom-right-radius: 4px;
  53. border: 1px solid #ddd;
  54. height:30px;
  55. margin-right:10px;
  56. padding:0 10px;
  57. text-align: center;
  58. }
  59. .el-pagination .btn-prev {
  60. border-top-left-radius: 4px;
  61. border-bottom-left-radius: 4px;
  62. border: 1px solid #ddd;
  63. height:30px;
  64. margin-right:10px;
  65. padding:0 10px;
  66. text-align: center;
  67. }
  68. .el-pager li{
  69. color: #333;
  70. text-decoration: none;
  71. background-color: #fff;
  72. border: 1px solid #ddd;
  73. font-size: 10px;
  74. width: 33px;
  75. height: 30px;
  76. margin-right:10px;
  77. }
  78. .el-pager li:not(.active):hover, .el-pagination button:hover {
  79. z-index: 3;
  80. color: #fff;
  81. background-color: #333;
  82. border-color: #333;
  83. }
  84. .el-pager li.active {
  85. background: #333!important;
  86. color:#fff;
  87. }
  88. .el-pagination button.disabled {
  89. color: #333;
  90. background-color: #fff;
  91. cursor: not-allowed;
  92. }
  93. .pagination {
  94. display: inline-block;
  95. padding-left: 0;
  96. margin: 20px 0;
  97. border-radius: 4px;
  98. }
  99. .pagination>li {
  100. display: inline;
  101. }
  102. input.page-number {
  103. vertical-align: inherit;
  104. display: inline-block;
  105. width: 40px;
  106. height: 31px;
  107. padding: 6px 6px;
  108. font-size: 14px;
  109. line-height: 1.42857143;
  110. color: #9B9792;
  111. text-align: center;
  112. background-color: #F6F5F4;
  113. background-image: none;
  114. border: 1px solid #ccc;
  115. border-top-left-radius: 4px;
  116. border-bottom-left-radius: 4px;
  117. box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
  118. transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
  119. }
  120. .page-a {
  121. background: #5078cb !important;
  122. color: #fff !important;
  123. float: right!important;
  124. }
  125. .page-a {
  126. color: #fff;
  127. border-color: #4574e8;
  128. padding: 6px 6px!important;
  129. font-size: 14px!important;
  130. border-top-right-radius: 4px!important;
  131. border-bottom-right-radius: 4px!important;
  132. text-decoration: none;
  133. height: 31px;
  134. }
  135. .page-wrap{
  136. text-align: center;
  137. margin: 30px 0;
  138. }
  139. .page-wrap ul, .page-wrap div {
  140. display: inline-block;
  141. margin: 0;
  142. }
  143. input.page-number {
  144. -moz-appearance:textfield;
  145. }
  146. input.page-number::-webkit-inner-spin-button,
  147. input.page-number::-webkit-outer-spin-button {
  148. -webkit-appearance: none;
  149. margin: 0;
  150. }
  151. .el-pager li.active+li {
  152. border: 1px solid #ccc;
  153. }
  154. </style>