StdPagination.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <script setup lang="ts">
  2. import {useGettext} from 'vue3-gettext'
  3. import {computed} from 'vue'
  4. const props = defineProps(['pagination', 'size'])
  5. const emit = defineEmits(['change', 'changePageSize'])
  6. const {$gettext} = useGettext()
  7. function change(num: number, pageSize: number) {
  8. emit('change', num, pageSize)
  9. }
  10. const pageSize = computed({
  11. get() {
  12. return props.pagination.per_page
  13. },
  14. set(v) {
  15. emit('changePageSize', v)
  16. props.pagination.per_page = v
  17. }
  18. })
  19. </script>
  20. <template>
  21. <div class="pagination-container" v-if="pagination.total>pagination.per_page">
  22. <a-pagination
  23. :current="pagination.current_page"
  24. v-model:pageSize="pageSize"
  25. :size="size"
  26. :total="pagination.total"
  27. @change="change"
  28. />
  29. </div>
  30. </template>
  31. <style lang="less">
  32. .ant-pagination-total-text {
  33. @media (max-width: 450px) {
  34. display: block;
  35. }
  36. }
  37. </style>
  38. <style lang="less" scoped>
  39. .pagination-container {
  40. padding: 10px 0 0 0;
  41. display: flex;
  42. justify-content: right;
  43. @media (max-width: 450px) {
  44. justify-content: center;
  45. }
  46. }
  47. </style>