Pagination.vue 673 B

12345678910111213141516171819202122232425262728293031323334
  1. <template>
  2. <v-pagination
  3. v-if="pagination.last"
  4. :model-value="modelValue"
  5. :length="pagination.last"
  6. rounded="circle"
  7. @update:model-value="onPageUpdated"
  8. />
  9. </template>
  10. <script setup lang="ts">
  11. import type { PropType } from "@vue/runtime-core";
  12. import type { Pagination } from "~/types/data";
  13. const props = defineProps({
  14. modelValue: {
  15. type: Number,
  16. required: true
  17. },
  18. pagination: {
  19. type: Object as PropType<Pagination>,
  20. required: true
  21. }
  22. });
  23. const emit = defineEmits(['update:modelValue']);
  24. const onPageUpdated = (newPage: number) => {
  25. emit('update:modelValue', newPage);
  26. };
  27. </script>
  28. <style scoped lang="scss">
  29. </style>