1.如何进行el-table表格分页
<div>
<el-table
:data="table_data.slice((currentPage-1)*pagesize,currentPage*pagesize)"
:current-page.sync="currentPage"
>
</el-table>
</div>
<div>
<p style="text-align: center">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:page-sizes="[10, 20, 30]"
:page-size="pagesize"
:pager-count="9"
layout="total,sizes, prev, pager, next,jumper"
:total="total">
</el-pagination>
</p>
</div>
2.分页后如何导出
思路:先把数据全部集中在一页(设置每页的条数和数据总数一样,并将当前页切换到第一页)–>导出–>恢复原样
3.采用el-pagination分页后自定义排序,排序后回到第一页
令this.currentPage=1,此时表格数据已经是第一页的数据了,但是el-pagination还在排序前所看页面
解决办法:在el-pagination中加入 :current-page.sync=“currentPage1”
<el-pagination :current-page.sync="currentPage"></el-pagination>
-
elementUI分页报错 Invalid prop: custom validator check failed for prop “pagerCount”
注意:pager-count只能为5-21的奇数