Pagination.vue 724 B

1234567891011121314151617181920212223242526272829303132333435
  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 { defineProps, defineEmits, ComputedRef } from "vue";
  12. import { PropType } from "@vue/runtime-core";
  13. import { Pagination } from "~/types/data";
  14. const props = defineProps({
  15. modelValue: {
  16. type: Number,
  17. required: true
  18. },
  19. pagination: {
  20. type: Object as PropType<Pagination>,
  21. required: true
  22. }
  23. });
  24. const emit = defineEmits(['update:modelValue']);
  25. const onPageUpdated = (newPage: number) => {
  26. emit('update:modelValue', newPage);
  27. };
  28. </script>
  29. <style scoped lang="scss">
  30. </style>