<template>
  <div class="pagination elPaginationOuter">
    <el-pagination
      background
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="currentPage"
      :page-sizes="trendTotalCount"
      :page-size="pagesize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="totalCount"
    >
    </el-pagination>
    <el-button
      class="goPageBtn"
      type="primary"
      size="mini"
    >跳转</el-button>
  </div>
</template>
<script>
// import { setResultCount } from "@/utils/auth"
export default {
  name: 'pagination',
  props: {
    totalCount: {
      type: Number,
      default: 0
    },
    pagesizeProps: {
      type: Number,
      default: 0
    },
    currentPageProps: {
      type: Number,
      default: 1
    }
  },
  computed:{
      trendTotalCount(){
        return [20,50,100]
      }  
  },
  watch:{
    currentPageProps(n,o){
      this.currentPage = n
    }
  },
  data () {
    return {
      currentPage: 1,
      pagesize: 0
    }
  },
  mounted () {
    this.pagesize = this.pagesizeProps
    this.currentPage = this.currentPageProps
  },
  methods: {
    //每页最大条数改变提交emit
    handleSizeChange (val) {
      // setResultCount(val)
      this.pagesize = val
      this.$emit('SizeChange', val)
    },
    //当前页改变提交emit
    handleCurrentChange (val) {
      this.currentPage = val
      this.$emit('CurrentChange', val)
    },
  }

}
</script>
<style scoped>
.goPageBtn{
  margin-left: 20px;
  background: #e8f4ff;
  color:#409EFF;
  border:none
}
</style>