vue 数组对象去重
that.phoneList = that.unique(that.phoneList)unique(arr) {const res = new Map();return arr.filter((arr) => !res.has(arr.id) && res.set(arr.id, 1))},其中以id作为检验数据的唯一...
·
that.phoneList = that.unique(that.phoneList,'id')
unique(arr, key) {
const res = new Map();
return arr.filter((arr) => !res.has(arr[key]) && res.set(arr[key], 1));
},
其中以id作为检验数据的唯一
更多推荐
已为社区贡献11条内容
所有评论(0)