报错信息:[Vue warn]: Invalid prop: custom validator check failed for prop “pagerCount”.
<template>
<div class="pagination">
<el-pagination
small
background
:layout="layout"
:total="total"
:current-page="query.pageNum"
:page-size="query.pageCount"
:pager-count="pagerCount"
:page-sizes="pageSizes"
@current-change="handleCurrentChange"
@size-change="handleSizeChange"
>
</el-pagination>
</div>
</template>
<script>
export default {
name: 'pagination',
data () {
return {
query: {
pageNum: 1,
pageCount: 10,
},
layout: "total, sizes, prev, pager, next, jumper",
total: 0,
pageSizes: [8, 24, 40],
pagerCount: 5,
}
},
methods: {
handleCurrentChange(val) {this.query.pageNum = val},
handleSizeChange(val) {this.query.pageCount = val},
}
}
</script>
解决:pager-count只能设置5-21的奇数。