elementui虚拟删除(并未上交到数据库的删除)
<el-table>
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="small"
type="text"
icon="el-icon-delete"
@click="equipmentPartsDeleteFalse(scope)"
></el-button>
</template>
</el-table-column>
</el-table>
js
equipmentPartsDeleteFalse(scope) {
//这里的scope.$index指的是下标,因为还未提交到后台,
//没有id所以就是前端通过下标进行删除
const index = scope.$index
this.$confirm('此操作将永久删除该条数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
this.parts.splice(index, 1)
this.msgSuccess('删除成功')
})
},