問題描述:第n頁僅有一條數(shù)據(jù),當(dāng)刪除這條數(shù)據(jù)時(shí)再一次請求數(shù)據(jù)列表,此時(shí)頁碼this.currentPage的值仍然是n,但實(shí)際上此時(shí)應(yīng)該發(fā)送的是n-1,因此需要做判斷,利用刪除該數(shù)據(jù)前的列表請求回來的total值減1,再對this.pageSize取天花板函數(shù)Math.ceil((_this.total - 1)/10)
noticeDel(params).then(res => {
console.log(res);
if (res.status === 200){
this.$message({
message: "刪除成功",
type: 'success',
duration: 1000,
onClose: () => {
this.currentPage = Math.ceil((this.dataCount - 1)/10);
this.getNoticeList();
}
})
}
})