<template>
  <div class="pagination-wrap">
    <el-pagination
      v-model:current-page="page"
      v-model:page-size="pageSize"
      :total="total"
      :page-sizes="[10, 20, 50, 100]"
      layout="total, sizes, prev, pager, next, jumper"
      background
      @current-change="$emit('change')"
      @size-change="$emit('change')"
    />
  </div>
</template>

<script setup lang="ts">
const page = defineModel<number>('page', { default: 1 })
const pageSize = defineModel<number>('pageSize', { default: 10 })

defineProps<{
  total: number
}>()

defineEmits<{
  change: []
}>()
</script>

<style scoped lang="scss">
.pagination-wrap {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
}
</style>
