page: {
pageNum: 1,
pageSize: 15,
totalRecords: 0,
pageTotal: 0,
},
在请求数据时赋值:
const res = await getData({ ...this.page })
if (res.code == 200) {
this.tableData = res.data.records
this.page.pageSize = res.data.size
this.page.totalRecords = res.data.total
this.page.pageNum = res.data.current
this.page.pageTotal = res.data.records?.length
}
删除完判断是不是当前页最后一条:
(单选,多选都适用)
const res = await del({ ids: ids })
if (res.code == 200) {
const totalPage = Math.ceil((this.page.totalRecords - 1) / this.page.pageSize)
this.page.pageNum = this.page.pageNum > totalPage ? totalPage :
this.page.pageNum
this.page.pageNum = this.page.pageNum < 1 ? 1 : this.page.pageNum
this.getData()
this.msgSuccess(res.msg)
}
版权声明:本文为weixin_66130133原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。