原因是没有给table下面的row加key,才导致的问题
解决方法:
在 el-table 标签里 加一个 row-key 属性

<el-table :data="tableData" @cell-dblclick="tableDbEdit" :row-key="getRowKey" style="width: 100%" border>
        <el-table-column prop="number" label="服务件数">
        </el-table-column>
        <el-table-column prop="total" label="总额(¥)">
        </el-table-column>
        <el-table-column label="操作">
          <template slot-scope="scope">
            <!-- <el-button type="primary" plain>删除</el-button> -->
            <a-popconfirm title="你确定要删除吗?" ok-text="确 定" cancel-text="取 消" @confirm="deleteTr(scope)"
              placement="topRight">
              <img src="../../assets/imgs/delete-b.svg" alt="" style="cursor: pointer;">
            </a-popconfirm>
          </template>
        </el-table-column>
      </el-table>
data(){
	return {
		tableData: [{
          id: 0,
          number: '',
          total: ''
        },]
	}
},
methods: {
    getRowKey (row) {
      return row.id
    },
    deleteTr (scope) {
      this.tableData.splice(scope.$index, 1)
    },
   }
Logo

前往低代码交流专区

更多推荐