del(row){
var _this = this;
this.$confirm('此操作将永久删除, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
_this.$axios.post("http://localhost:8080/drug/deleteDrug",this.$qs.stringify({"id":row.id,"photo":row.photo})).then(function () {
_this.$message.success("删除成功");
// 为了在删除最后一页的最后一条数据时能成功跳转回最后一页的上一页
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
_this.queryDrugList();
}).catch(function () {
_this.$message.error("删除失败");
})
})
}
vue最后一页所有数据删除,自动回到上一页
最新推荐文章于 2023-02-11 16:34:28 发布