pageComponent.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <div class="page-wrap" v-if="total/pageSize>1">
  3. <el-pagination
  4. :current-page.sync="current"
  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: this.current
  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. 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 .btn-next, .el-pagination .btn-prev {
  54. color: #337ab7;
  55. }
  56. .el-pager li{
  57. color: #337ab7;
  58. text-decoration: none;
  59. background-color: #fff;
  60. border: 1px solid #ddd;
  61. font-size: 10px;
  62. }
  63. .el-pager li:not(.active):hover, .el-pagination button:hover {
  64. z-index: 3;
  65. color: #23527c;
  66. background-color: #eee;
  67. border-color: #ddd;
  68. }
  69. .el-pager li.active {
  70. background: #5078cb!important;
  71. }
  72. .el-icon-arrow-left:before {
  73. content: "\f100";
  74. font-family: FontAwesome;
  75. }
  76. .el-icon-arrow-right:before {
  77. content: "\f101";
  78. font-family: FontAwesome;
  79. }
  80. .el-pagination button.disabled {
  81. color: #337ab7;
  82. background-color: #fff;
  83. cursor: not-allowed;
  84. }
  85. .pagination {
  86. display: inline-block;
  87. padding-left: 0;
  88. margin: 20px 0;
  89. border-radius: 4px;
  90. }
  91. .pagination>li {
  92. display: inline;
  93. }
  94. input.page-number {
  95. vertical-align: inherit;
  96. display: inline-block;
  97. width: 40px;
  98. height: 31px;
  99. padding: 6px 6px;
  100. font-size: 14px;
  101. line-height: 1.42857143;
  102. color: #9B9792;
  103. text-align: center;
  104. background-color: #F6F5F4;
  105. background-image: none;
  106. border: 1px solid #ccc;
  107. border-top-left-radius: 4px;
  108. border-bottom-left-radius: 4px;
  109. box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
  110. transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
  111. }
  112. .page-a {
  113. background: #5078cb !important;
  114. color: #fff !important;
  115. float: right!important;
  116. }
  117. .page-a {
  118. color: #fff;
  119. border-color: #4574e8;
  120. padding: 6px 6px!important;
  121. font-size: 14px!important;
  122. border-top-right-radius: 4px!important;
  123. border-bottom-right-radius: 4px!important;
  124. text-decoration: none;
  125. height: 31px;
  126. }
  127. .page-wrap{
  128. float: right;
  129. margin: 30px 0;
  130. }
  131. .page-wrap ul, .page-wrap div {
  132. display: inline-block;
  133. margin: 0;
  134. }
  135. </style>