pageComponent.vue 3.3 KB

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