data(){
return {
currentPage: 1, // 当前页数
total:0, // 总页数
pageSize:5, // 每页显示多少条
},

删除时:

elementui删除最后一页数据时跳转回上一页_批量删除

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

批量删除时:

elementui删除最后一页数据时跳转回上一页_批量删除_02

// 批量删除最后一页数据跳转回上一页
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

elementui删除最后一页数据时跳转回上一页_数据_03


elementui删除最后一页数据时跳转回上一页_批量删除_04

elementui删除最后一页数据时跳转回上一页_当前页_05