operatData.value.seriesList = res.data.seriesList.reduce((accumulator, current) => { const existing = userOptionsColor.find(item => item.name === current.name) if (existing) { accumulator.push({ ...current, ...existing }) return accumulator } return accumulator }, [])
res.data.seriesList 和 userOptionsColor 为两个对象数组 通过判断两个对象数组中的某项name值是否相同 如果相同 取出来push到新数组中即可标签:name,existing,current,accumulator,数组,seriesList,js,属性 From: https://www.cnblogs.com/zhu-xl/p/17519334.html