Pagination.vue 641 B

123456789101112131415161718192021222324252627282930313233
  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'
  12. import type { Pagination } from '~/types/data'
  13. 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"></style>