<template>
  <div class="pagination" v-if="total">
    <el-pagination
      background
      layout="total,prev,pager,next,sizes,jumper"
      :pager-count="5"
      :total="total"
      :current-page="current"
      :page-size="size"
      :page-sizes="pageSizes"
      @current-change="changePagination"
      @size-change="changeSize"
    >
    </el-pagination>
  </div>
</template>

<script>
export default {
  props: {
    total: {
      required: true,
      type: Number,
      default: 0,
    },
    size: {
      required: true,
      type: Number,
      default: 10,
    },
    current: {
      required: true,
      type: Number,
      default: 1,
    },
  },
  data() {
    return {
      pageSizes: [10, 20, 30, 40, 50, 100, 200],
    };
  },
  computed: {},
  methods: {
    changePagination(cur) {
      this.$emit("currentChange", cur);
    },
    changeSize(size) {
      this.$emit("sizeChange", size);
    },
  },
};
</script>

<style lang="less" scoped>
</style>