pageComponent.vue 3.3 KB

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