<template>
  <div class="bg-pagination">
    <el-pagination
      :small="small"
      :currentPage="page"
      :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: {
    small: {
      type: Boolean,
      default: () => false
    },
    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>
