<!--
* @Descripttion:单行删除
* @version: 0.0.1
* @Author: PengShuai
* @Date: 2022-06-01 17:30:04
* @LastEditors: PengShuai
* @LastEditTime: 2022-06-01 17:30:04
-->
// 数据源
demoData: [
{
id: '1',
name: '奥巴马',
},
{
id: '2',
name: '狗头',
},
{
id: '3',
name: '卢锡安',
},
{
id: '4',
name: '盖伦',
},
{
id: '5',
name: '赵信',
},
],
methods: {
demo() {
console.log('全部数据 5条')
console.log(this.demoData)
//? 单选
//! 删除单行数据
const del = '3'
this.demoData = this.demoData.filter((o) => {
return o.id !== del
})
console.log('删除单行所返回的数据 4条')
console.log(this.demoData)
},
},