数组中的对象根据某个值去重

this.checkedDataPower = this.checkedDataPower.reduce((preVal, curVal) => {
  if (!obj[curVal.dataPowerCode]) {
    obj[curVal.dataPowerCode] = true;
    preVal.push(curVal);
  }
  return preVal;
}, []);

你可能感兴趣的:(vue.js)