<!-- 分页模块 -->
<template>
  <div class="paging">
    <el-pagination
      ref="pagination"
      :style="paginationStyle"
      v-bind="$attrs"
      v-on="$listeners"
      @size-change="pageSizeChange"
      @current-change="pageCurrentChange"
      :page-size="pageSize"
      :total="totalCount"
      :current-page="currentPage"
      :layout="layout"
      :page-sizes="pageSizes"
    >
    </el-pagination>
  </div>
</template>

<script>
export default {
  name: "pagination-view",
  props: {
    currentPage: {
      type: Number,
      default: 1,
    },
    totalCount: {
      type: Number,
      default: 0,
    },
    pageSize: {
      type: Number,
      default: 20,
    },
    layout: {
      type: String,
      default: "total, sizes, prev, pager, next, jumper",
    },
    pageSizes: {
      type: Array,
      default: () => [10, 20, 50, 80, 100],
    },
    paginationStyle: {
      type: [String, Object],
      default: () => ({ textAlign: "right" }),
    },
  },
  methods: {
    pageSizeChange(arg) {
      this.$emit("page-size-change", arg);
    },
    pageCurrentChange(arg) {
      this.$emit("page-current-change", arg);
    },
  },
};
</script>
<style lang="less" scoped>
.paging {
  margin-right: 24px;
}
/deep/ .el-input--small .el-input__inner {
  border-radius: 3px;
}
</style>
