【vue】筛选出两个数组相同/不同的元素,构成新数组
2022-02-19 本文已影响0人
胖胖爱吃鱼啊
1、不同
let list= [];
list = this.array1.filter(item=> array2.indexOf(item) === -1);
2、相同
let list= [];
list = this.array1.filter(item=> array2.indexOf(item) !== -1);
let list= [];
list = this.array1.filter(item=> array2.indexOf(item) === -1);
let list= [];
list = this.array1.filter(item=> array2.indexOf(item) !== -1);