下面展示一些 内联代码片
。
突破点 :通过传参行数据 record
<template slot="operation" slot-scope="text, record">
<div class="editable-row-operations">
<span>
<a :disabled="editingKey !== '' " @click="() => getDetail(record)">详情</a>
<a :disabled="editingKey !== '' " @click="() => handleEdit(record)">编辑</a>
<a :disabled="editingKey !== '' " @click="() => handleDelete(record)">删除</a>
</span>
</div>
</template>
不需要绑定数据
// js
//data函数
无
//methods函数
methods:{
// 删除
handleDelete (record) {
// console.log('record', record)
const target = this.tableList.filter(item => item !== record)
this.tableList = target
},
}
**
总结
1.不好传含数据key值,就传整行数据
2.对比筛选数据,filter函数此处过滤走,留下数据: item => item !== record
**