js数组对象中,新增对象前判断是否已有重复的 此处的背景是在vue中,data已经定义了authDatas data中: authDatas : [{code:1,value:'qq'},{code:2,value:'weixin'}] this.authDatas.forEach(function(item,index) { if (item.code === authDatasObj.code) { that.authDatas.splice(index,1) // 删除这个重复的元素 } })