自定义:data-id--把后台传入id渲染到每个自定义id上
:data-id="scope.row.id"
结构
<el-button
style="color:#F93838;float:left"
size="mini"
type="text"
:data-id="scope.row.id"
@click.native.prevent="handleDelete(scope.$index, tableData,scope.row.id,scope.row.report_url)"
class="cursor"
>删除</el-button>
点击时获取到一行点击确定删除
handleDelete(index, row, id, url) {
this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
center: true
})
.then(() => {
`本地删除`
row.splice(index, 1);
this.$message({
type: "supickeryearess",
message: "删除成功!"
});
`线上删除url图片和一行数据`
let obj = {};
obj.id = id;
obj.url = url;
delreport(obj);
})
.catch(() => {
this.$message({
type: "info",
message: "已取消删除"
});
});
},
网友评论