天天都有好心情哦。
// 删除
delete(row, index) {
this.$confirm('确认删除?删除后将不能恢复!', {
title: '提示',
type: 'warning',
closeOnClickModal: false
}).then(() => {
let param = {
unid: row.unid,
}
del(param).then(res => {
if (res.data.code == 200) {
if (this.tableData.length === 1) { //如果数组长度为1
this.currentPage = this.currentPage - 1; //当前页=当前页-1
if (this.currentPage === 0) {//如果当前页===0时
this.currentPage = 1;//默认当前页为1
}
}
this.$notify({
title: "提示",
message: "删除成功!",
type: "success"
});
this.getOeeQrData()
} else {}
}).catch(error => {
})
})
},
或者 if (this.tableData.currentPage === 1 && this.currentPage > 1) {
this.currentPage --
}