vue el-table 没有唯一标识时批量删除

2023-06-29  本文已影响0人  王哈哈zzz

一、需求描述:

<el-popconfirm title="这是一段内容确定删除吗?" @confirm="delinfo" >
    <el-button slot="reference" class="filter-item" size="mini" type="danger" icon="el-icon-delete">删除</el-button>
</el-popconfirm>
<el-table ref="multipleTable" :data="showlistData" @selection-change="handleSelectionChange" 
:row-class-name="tableRowClassName">
//row-class-name添加下标
tableRowClassName(row, index) {
  row.row.index = row.rowIndex;
},
handleSelectionChange(val) {
    this.multipleSelection = val;
},
delinfo(){
  let that = this
  this.multipleSelection.forEach(item => {
    that.tableData = that.tableData.filter(items =>{
        return items.index != item.index 
    })
 })
},
上一篇 下一篇

猜你喜欢

热点阅读