pagination.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <template>
  2. <div class="pagenation--wrapper">
  3. <div class="total--wrapper">
  4. Total : <span class="total--count">{{ props.pageObj.totalCnt }}</span>
  5. </div>
  6. <div
  7. v-if="props.pageObj.totalCnt && props.pageObj.totalCnt > 0"
  8. class="pager--btn--wrap"
  9. >
  10. <v-btn
  11. flat
  12. class="page--btn prev--btn"
  13. :disabled="pageObj.page == 1"
  14. @click="$emit('chg_page', pageObj.page - 1)"
  15. />
  16. <div class="page--numb">
  17. <span class="current">{{ props.pageObj.page }}</span>/<span>{{ totalPages }}</span>
  18. </div>
  19. <v-btn
  20. flat
  21. class="page--btn next--btn"
  22. :disabled="pageObj.page == totalPages || pageObj.totalCnt == 0"
  23. @click="$emit('chg_page', pageObj.page + 1)"
  24. />
  25. </div>
  26. <slot name="rightArea" />
  27. </div>
  28. </template>
  29. <script setup>
  30. /***********************
  31. * plugins inject
  32. ************************/
  33. // let pageObj = ref( {
  34. // page: 1, // 현재 페이지
  35. // pageSize: 10, // 테이블 조회 데이터 개수
  36. // totalCnt: 0, // 전체 페이지
  37. // })
  38. // props
  39. const props = defineProps({
  40. pageObj: Object,
  41. })
  42. // 발신 이벤트 선언
  43. const emit = defineEmits(['chg_page'])
  44. const totalPages = computed(() => {
  45. return Math.ceil(props.pageObj.totalCnt / props.pageObj.pageSize)
  46. })
  47. /***********************
  48. * data & created
  49. ************************/
  50. /***********************
  51. * Methods
  52. ************************/
  53. </script>