去掉为空字段
const filteredArr = this.arouselList.filter((obj) => {
return !(Object.prototype.hasOwnProperty.call(obj, 'pic') && (obj.pic === null || obj.pic === undefined));
});
去掉不为空的字段
const filteredArr = arr.filter((obj) => {
return Object.prototype.hasOwnProperty.call(obj, 'age') && (obj.age === null || obj.age === undefined);
});
console.log(filteredArr); // [{id: 2, name: 'bar', age: null}, {id: 3, name: 'baz', age: undefined}, {id: 4, name: 'qux'}]