pageComponent.vue 3.1 KB

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