pageComponent.vue 3.4 KB

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