<template>
  <div class="bg-pagination">
    <el-pagination
      v-model:currentPage="page"
      v-model:page-size="size"
      :page-sizes="pageSizes"
      :layout="layout"
      :total="total"
      @size-change="changeSize"
      @current-change="changePage"
      :background="background"
      :disabled="disabled"
    />
  </div>
</template>

<script>
export default {
  name: "pagination",
  props: {
    page: {
      type: Number,
      default: 1
    },
    size: {
      type: Number,
      default: 10,
    },
    pageSizes: {
      type: Array,
      default: [10,50,100]
    },
    total: {
      type: Number,
      default: 0
    },
    layout: {
      type: String,
      default: "total, sizes, prev, pager, next, jumper"
    },
    background: {
      type: Boolean,
      default: false
    },
    disabled: {
      type: Boolean,
      default: false
    }
  },
  setup(props, context) {
    const changePage = (val) => {
      context.emit("change-page",val)
    }
    const changeSize = (val) => {
      context.emit("change-size",val)
    }
    return {
      changePage,
      changeSize
    }
  },
}
</script>