element的修改和删除行间拿数据 ------------------id-------------------------------------
<template slot-scope="scope">
<el-button
type="text"
@click="$router.push(`/addclass?cid=${scope.row.id}`)"
>修改</el-button
>
<!-- <el-button type="text">删除</el-button> -->
<el-popover
placement="top"
width="160"
v-model="scope.row.isShowPopover"
>
<p>确定删除该条数据吗?</p>
<div style="text-align: right; margin: 0">
<el-button
size="mini"
type="text"
@click="scope.row.isShowPopover = false"
>取消</el-button
>
<el-button
type="primary"
size="mini"
@click="delClass(scope.row)"
>确定</el-button
>
</div>
<el-button
type="text"
style="margin-left: 5px"
class="del-slot-btn user-list-operate"
slot="reference"
>
删除
</el-button>
</el-popover>
</template>
delClass(item) {
let fd = new FormData();
fd.append("id", item.id);
this.axios.post("/index/teacher_course_del", fd).then((res) => {
console.log(res);
if (res.data.code === 0) {
this.$message({
type: "success",
message: res.data.msg,
});
this.LessonList = this.LessonList.filter((ele) => {
return ele.id !== item.id;
});
} else {
this.$message({
type: "error",
message: res.data.msg,
});
}
});
},
andv的修改和删除行间拿数据------------------------id----------------------------------
const columns = [
{
title: "操作",
dataIndex: "operation",
key: "operation",
ellipsis: true,
width: 120,
align: "center",
scopedSlots: { customRender: "operation" },
},
];
<template slot="operation" slot-scope="text, record">
<a>
<span @click="showModal(record.id)" v-if="record.id !== 1">
编辑</span
>
<!-- 删除弹框 -->
<a
style="margin-left: 30px"
@click="delModal(record.id)"
v-if="record.id !== 1"
>
删除</a
>
</a>
</template>
//点击删除
delModal(id) {
this.del_id = id;
},
//确认删除
delOk() {
let fd = new FormData();
fd.append("id", this.del_id);
this.axios.post("/home/company_del", fd).then((res) => {
if (res.data.code == 0) {
this.$message.success(res.data.msg);
this.delShow = false;
this.getUnitList();
} else {
this.$message.error(res.data.msg);
}
});
},
slot-scope=“text, record“
于 2021-12-29 11:45:19 首次发布