<template>
  <div class="pagination-con" v-if="total!=0">
    <a-pagination
      size="small"
      :total="total"
      :current="current"
      :pageSize="pageSize"
      show-size-changer
      :show-total="total => `共 ${total} 条记录`"
      @showSizeChange="changePageSize"
      @change="changePage" />
  </div>
</template>
<script>
export default {
  name: 'TablePagination',
  props: {
    total: {
      type: [String, Number],
      default: 0
    },
    current: {
      type: [String, Number],
      default: 1
    },
    pageSize: {
      type: [String, Number],
      default: 20
    }
  },
  data () {
    return {}
  },
  methods: {
    //  分页  一页多少条change
    changePageSize (current, pageSize) {
      this.$emit('changePageSize', current, pageSize)
    },
    //  分页 页码change
    changePage (current) {
      this.$emit('changePage', current)
    }
  }
}
</script>
<style lang="less">
  .pagination-con{
    text-align: right;
    margin: 10px 0;
  }
</style>
