vue 如何过滤出数组里面的空对象并删除

数据格式如下:

 let arr2 = [
    {
        "id": 3,
        "fullName": "82818g1gg",
        "mail": "59861788@qq.com",
        "phone": "18561333200",
        "creationDate": "2021-09-17 16:53:57",
        "lastUpdate": "2021-09-27 15:11:32",
        "state": "ACTIVE",
        "username": "82818g1gg",
        "creatorId": 1,
        "creationName": "ghb111",
        "updaterId": 1,
        "updaterName": "",
        "index": 0
    },
    {
        "userAccount": "",
        "fullName": "",
        "password": "",
        "phone": "",
        "mail": "",
        "used": 1,
        "remarks": ""
    },
    {
        "id": 2,
        "fullName": "ghb1211",
        "creationDate": "2021-09-17 11:34:04",
        "lastUpdate": "2021-09-17 11:34:04",
        "state": "ACTIVE",
        "username": "ghb1211",
        "creatorId": 1,
        "creationName": "ghb111",
        "updaterId": 1,
        "updaterName": "ghb111",
        "index": 1
    }
]

最后想把空的那一项删掉,保留有数据的项

判断是不是空,是空,直接删除。

arr2.forEach((item,index)=>{
  if(!item.userAccount){
    arr2.splice(index,1)
  }
})

是只要有一个属性为空就删除还是,某个属性? filter过滤一下就行

遍历 delete属性