element-ui纯前端分页

直接上代码

<el-table
:data="tableData.slice((currentPage-1)*pageSize,currentPage*pageSize)"
border
style="width: 100%">
<el-table-column type="selection"></el-table-column>
<el-table-column prop="date" label="日期" ></el-table-column>
</el-table>

<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10, 20, 30, 50, 100]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="tableData.length"
style="float:right;margin-top:15px;"
></el-pagination>


data:{
pageSize: 10, //每页多少条
currentPage: 1, // 当前页

tableData: [{
  date: '2016-05-02',
name: '王小虎',
address: '上海市普陀区金沙江路 1518 弄'
}, {
date: '2016-05-04',
name: '王小虎',
address: '上海市普陀区金沙江路 1517 弄'
}, {
date: '2016-05-01',
name: '王小虎',
address: '上海市普陀区金沙江路 1519 弄'
}, {
date: '2016-05-03',
name: '王小虎',
address: '上海市普陀区金沙江路 1516 弄'
}]
}

methods: {

// 每页多少条
handleSizeChange(val) {
this.pageSize = val;
},
// 当前页
handleCurrentChange(val) {
this.currentPage = val;
},
},
posted @ 2020-03-02 17:10  Sea。  阅读(1535)  评论(0编辑  收藏  举报