//判断选中的项是否有不相同的模型 const hasNameProperty = _this.selectedOrderList.filter(order => order.hasOwnProperty("item_model_id")); if (hasNameProperty.length > 0) { const isEveryNameEqual = hasNameProperty.reduce((prev, curr) => { if (prev === true && curr.item_model_id === hasNameProperty[0].item_model_id) { return true; } else { return false; } }, true); if (!isEveryNameEqual) { alert("请选择需要相同的物料"); return; } } else { alert("请选择需要相同的物料"); return; }
标签:检索,return,js,item,数组,hasNameProperty,model,true,id From: https://www.cnblogs.com/QiangQiangDai/p/17732819.html