index.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <template>
  2. <div class="simple-pagination p-2">
  3. <van-pagination
  4. v-model="currentPage"
  5. :total-items="total"
  6. :items-per-page="pageItems"
  7. :show-page-size="6"
  8. :force-ellipses="true"
  9. :mode="mode"
  10. @change="$emit('change', currentPage)"
  11. />
  12. </div>
  13. </template>
  14. <script>
  15. import { mapGetters } from 'vuex'
  16. export default {
  17. props: {
  18. total: {
  19. type: Number,
  20. default: 0,
  21. },
  22. pageItems: {
  23. type: Number,
  24. default: 10,
  25. },
  26. },
  27. data() {
  28. return {
  29. currentPage: 1,
  30. }
  31. },
  32. computed: {
  33. ...mapGetters(['isPc']),
  34. mode() {
  35. return this.isPc ? 'multi' : 'simple'
  36. },
  37. },
  38. }
  39. </script>
  40. <style scoped lang="scss">
  41. @media screen and (min-width: 768px) {
  42. .simple-pagination {
  43. display: flex;
  44. justify-content: center;
  45. .van-pagination {
  46. ::v-deep {
  47. .van-pagination__item {
  48. margin-left: 4px;
  49. margin-right: 4px;
  50. color: #bc1724;
  51. &:active {
  52. color: #fff;
  53. background-color: #bc1724;
  54. }
  55. }
  56. .van-pagination__prev,
  57. .van-pagination__next {
  58. background: transparent !important;
  59. color: #101010;
  60. &::after {
  61. border-color: transparent !important;
  62. }
  63. &:hover {
  64. color: #bc1724;
  65. }
  66. }
  67. .van-pagination__item--active {
  68. background-color: #bc1724 !important;
  69. color: #fff;
  70. }
  71. }
  72. }
  73. }
  74. }
  75. @media screen and (max-width: 768px) {
  76. .van-pagination {
  77. ::v-deep {
  78. .van-pagination__prev,
  79. .van-pagination__next {
  80. color: #101010;
  81. &::after {
  82. border-color: transparent !important;
  83. }
  84. &:active {
  85. color: #fff;
  86. background-color: #bc1724;
  87. }
  88. }
  89. }
  90. }
  91. }
  92. </style>