data(){
return {
currentPage: 1, // 当前页数
total:0, // 总页数
pageSize:5, // 每页显示多少条
},
删除时:
const totalPage = Math.ceil((_this.total -1 ) / _this.pageSize) // 总页数
_this.currentPage = _this.currentPage > totalPage ? totalPage : _this.currentPage
_this.currentPage = _this.currentPage < 1 ? 1 : _this.currentPage
批量删除时:
// 批量删除最后一页数据跳转回上一页
const totalPage = Math.ceil((this.total - this.multipleSelection.length) / this.pageSize) // 剩余数据总页数
this.currentPage = this.currentPage > totalPage ? totalPage : this.currentPage
this.currentPage = this.currentPage < 1 ? 1 : this.currentPage