项目场景:
用element的分页(Pagination)组件写分页
问题描述:
page-size属性不管用<el-pagination
background
layout="total , sizes , prev, pager, next , jumper"
:page-size ="3"
:total="total"
:current-page ="pagenum"
@current-change ="currentchange"
@size-change ="sizechange"
>
</el-pagination>
这里设置了3 , 但是总页码依然是按 总数除以10来算的
解决方案:
是因为我写了sizes 所以一定要设置:page-sizes属性 , 数组中一定要包括初始值
不然就会按默认值的第一个值:10来计算
<el-pagination
background
layout="total , sizes , prev, pager, next , jumper"
:page-size ="pagesize"
:page-sizes = "[3, 10, 50, 500]"
:total="total"
:current-page ="pagenum"
@current-change ="currentchange"
@size-change ="sizechange"
>
</el-pagination>