/*
id: 要删除的数据ID
index: 列表(数组)下标
*/
handleDelete(id, index) {
this.$confirm('此操作将永久删除该项, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
// this.sysLink.postURL:接口地址
this.$post(this.sysLink.postURL, { id: id }, res => {
// this.successCode:接口正确返回代码
if (res.code === this.successCode) {
// items:列表(数组)变量
this.items.splice(index, 1)
this.$message({
type: 'success',
message: '删除成功'
})
} else {
this.$message.error(res.message)
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
}
基于element ui的列表数据删除逻辑
最新推荐文章于 2023-07-28 14:36:45 发布