pagesize:10,每页条数
currentPage:1, 当前页
userRoleList.length 表格的长度
let ids = []
this.multipleSelection.forEach((item)=>{
ids.push(item.id)
})
let formData = new FormData()
formData.append('ids',ids)
axios.post('/api/user/batchDelUser',formData).then(res=>{
//总页数(每次删除计算总页数)
const totalPage = Math.ceil((this.userRoleList.length - ids.length) / this.pagesize)
//当前页大于总页数代表已经删除最后一条数据 将总页数赋值给当前页 会跳转到上一页
this.currentPage = this.currentPage > totalPage ? totalPage : this.currentPage
//当页数小于为0 就给它为1页 否则就还是当前页
this.currentPage = this.currentPage < 1 ? 1 : this.currentPage
this.userList()
})