<template>
  <div class="page_div" :style="{ textAlign: position || 'center' }">
    <div class="page_div_left">
      <slot name="pageSlot"></slot>
    </div>
    <div class="page_div_right">
      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :hide-on-single-page="false"
        :current-page="currentPage" :pager-count="7" :page-sizes="[10, 15, 20, 30, 50]" :page-size="pageSize" background
        layout="total,sizes,prev, pager, next" :total="total">
      </el-pagination>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    total: {
      type: Number,
      default: 0,
    },
    position: {
      type: String,
      default: "right",
    },
    pageSize: {
      type: Number,
      default: 10,
    },
    currentPage: {
      type: Number,
      default: 1,
    },
  },
  data() {
    return {};
  },
  methods: {
    // 条数变化
    handleSizeChange(e) {
      this.$emit("handleSizeChange", e);
    },
    // 页码变化
    handleCurrentChange(e) {
      this.$emit("handleCurrentChange", e);
    },
  },
};
</script>

<style lang="less" scoped>
.page_div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 0;
  .page_div_right {
    flex: 1;
  }
}
</style>