直接上代碼 <el-table :data="tableData.slice((currentPage-1)*pageSize,currentPage*pageSize)" border style="width: 100%"> <el-table-column type="selection">< ...
直接上代碼
<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;
},
},