element ui组件的表格分页功能
1.在el-table添加
<el-table
:data="
tableData.slice(
(currentPage - 1) * pagesize,
currentPage * pagesize
)
"
>
2.在el-pagination添加
<el-pagination
layout=" prev, pager, next, sizes, jumper"
:page-sizes="[5, 10]"
:page-size="pagesize"
:total="tableData.length"
:pager-count="5"
:current-page="currentPage"
@current-change="handleCurrentChange"
@size-change="handleSizeChange"
>
3.data添加
data () {
return {
tableData:[{'你的数据'}],
currentPage: 1,
pagesize: 5,
}
}
4.在methods添加
handleCurrentChange (val) {
this.currentPage = val;
},
handleSizeChange (val) {
this.pagesize = val;
},
|