绑定点击事件
scope.$index,scope.row:获取当前行的下标,当前行的信息
<el-table-column fixed="right" label="操作" width="100">
<template v-slot:default="scope">
<el-button type="text" @click="delMember(scope.$index,scope.row)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
发送ajax执行删除事件
删除之后,this.listData.splice表示要在listData删除的数据,实时更新
delMember(index, row) {
this.form = this.tableData[index]
this.$axios.get('/head/delVerifier', {
params: {
id: this.form.id
}
}).then(res => {
if (res.data.msg === "删除成功") {
//删除本行
this.listData.splice(index, 1)
this.listVisible = true
} else {
this.listVisible = true
}
})
},