PageNumber.vue 822 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <template>
  2. <div :class="classes">
  3. <ul class="page-number-rect-list" v-if="type === 'rect' && current % 2">
  4. <li
  5. v-for="n in total"
  6. :key="n"
  7. :class="{ 'rect-li-act': n === current }"
  8. ></li>
  9. </ul>
  10. <div class="page-number-text-cont" v-if="type === 'text'">
  11. 第{{ current }}页(共{{ total }}页)
  12. </div>
  13. </div>
  14. </template>
  15. <script>
  16. export default {
  17. name: "page-number",
  18. props: {
  19. type: {
  20. type: String,
  21. default: "text",
  22. validator(val) {
  23. return ["text", "rect"].indexOf(val) !== -1;
  24. }
  25. },
  26. total: {
  27. type: Number,
  28. default: 1
  29. },
  30. current: {
  31. type: Number,
  32. default: 1
  33. }
  34. },
  35. computed: {
  36. classes() {
  37. return ["page-number", `page-number-${this.type}`];
  38. }
  39. }
  40. };
  41. </script>