解决方法:
delBlackPerson(row){
let params= {
id:row.id
}
this.$confirm('确定删除该用户吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deletePerson(params).then(res => {
if (res.code == 200) {
this.$message({
type: 'success',
message: '删除成功!'
});
let totalPage = Math.ceil((this.total-1) / this.pageSize) //加上这三行就可以解决了
let currentPage = this.currentPage > totalPage ? totalPage : this.currentPage
this.currentPage = currentPage < 1 ? 1 : currentPage
this.getTableList(); //重新查询一次
} else{
this.$message({
type: 'error',
message: res.message
});
}
});
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
},