自学内容网 自学内容网

vue判断对象数组里是否有重复数据

@TOCvue判断对象数组里是否有重复数据

try {
//通过产品编码赛选出新的数组  在比较
let names = this.goodsJson.map(item => item["productCode"]);
 let nameSet = new Set(names)
 if (nameSet.size != names.length) {
 this.$message({
 message: '警告!产品选项有重复选择的,请去重!',
 type: 'warning'
 });
 throw new Error("false")
 }

原文地址:https://blog.csdn.net/u014722196/article/details/142872569

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!