<!--
 * @Author: wangming
 * @Date: 2020-06-19 15:40:04
 * @LastEditors: wangming
 * @LastEditTime: 2020-06-19 21:14:50
 * @Description: file content
-->
<template>
  <div class="tr mt10">
    <a-pagination
      v-show="total > 0"
      :show-total="(total) => `共 ${total} 条数据`"
      show-size-changer
      :page-size-options="['10', '20', '50', '100', '200']"
      :current="pageNo"
      :total="total"
      :page-size="pageSize"
      @change="search"
      @showSizeChange="search"
    >
      <template slot="buildOptionText" slot-scope="props">
        <span>{{ props.value }}条/页</span>
      </template>
    </a-pagination>
  </div>
</template>

<script>
export default {
  props: {
    total: {
      //list总条数
      type: Number,
      default: 0,
    },
    pageSize: {
      //默认条数
      type: Number,
      default: 10,
    },
    pageNo: {
      //初始页数
      type: Number,
      default: 0,
    },
  },
  methods: {
    search(pageNo, pageSize) {
      this.$emit('update:pageSize', pageSize);
      this.$emit('update:pageNo', pageNo);
      this.$nextTick(() => {
        this.$emit('change');
      });
    },
  },
};
</script>

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