一、核心代码
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除</el-button>
handleDelete(index, row) {
// console.log(index, row);
this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
instance.delete("/user/delete?id=" + row.id).then(res => {
if (res.data.state) {
this.$message({
type: 'success',
message: res.data.msg
});
//刷新数据
this.findAll();
} else {
this.$message({
showClose: true,
message: res.data.msg,
type: 'error'
});
}
});
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
二、效果展示