<el-table size='medium' :data="currentTableData" border></el-table>
<el-pagination v-show="isShowPage"
background
:page-size="10"
style="float:right;margin-top:15px;"
:current-page.sync="currentPage"
@current-change='handleCurrentChange'
layout="total, prev, pager, next, jumper"
:total="tableData.length">
</el-pagination>
data() {
return {
tableData: [],
currentTableData: [],
currentPage: 1, // 当前页
}
},
methods:{
//获取表格数据方法:
tableMe() {
this.$http.post().then(res => {
if (res.data.success) {
this.tableData = res.data.data.result
this.currentTableData = this.tableData.slice(0, 10)
}
})
.catch(function(error) {
console.log(error)
})
},
handleCurrentChange() {
this.currentTableData = this.tableData.slice(
(this.currentPage - 1) * 10,
this.currentPage * 10
)
},
}