index.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <div class="simple-pagination p-2">
  3. <van-pagination
  4. v-model="currentPage"
  5. :total-items="total"
  6. :items-per-page="10"
  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: 1000,
  21. },
  22. },
  23. data() {
  24. return {
  25. currentPage: 1,
  26. }
  27. },
  28. computed: {
  29. ...mapGetters(['isPc']),
  30. mode() {
  31. return this.isPc ? 'multi' : 'simple'
  32. },
  33. },
  34. }
  35. </script>
  36. <style scoped lang="scss">
  37. @media screen and (min-width: 768px) {
  38. .simple-pagination {
  39. display: flex;
  40. justify-content: center;
  41. .van-pagination {
  42. ::v-deep {
  43. .van-pagination__item {
  44. margin-left: 4px;
  45. margin-right: 4px;
  46. color: #bc1724;
  47. &:active {
  48. color: #fff;
  49. background-color: #bc1724;
  50. }
  51. }
  52. .van-pagination__prev,
  53. .van-pagination__next {
  54. background: transparent !important;
  55. color: #101010;
  56. &::after {
  57. border-color: transparent !important;
  58. }
  59. &:hover {
  60. color: #bc1724;
  61. }
  62. }
  63. .van-pagination__item--active {
  64. background-color: #bc1724 !important;
  65. color: #fff;
  66. }
  67. }
  68. }
  69. }
  70. }
  71. @media screen and (max-width: 768px) {
  72. .van-pagination {
  73. ::v-deep {
  74. .van-pagination__prev,
  75. .van-pagination__next {
  76. color: #101010;
  77. &::after {
  78. border-color: transparent !important;
  79. }
  80. &:active {
  81. color: #fff;
  82. background-color: #bc1724;
  83. }
  84. }
  85. }
  86. }
  87. }
  88. </style>