我正在尝试删除数组中的重复值对象,但不起作用...我认为重复函数正在起作用,但没有反映在li
列表。你能找出我需要改变的地方吗?
我的服务文件:
addComp(Names,c){
this.item.push({ name: Names, componentid: c});
this.uniqueArray = this.removeDuplicates(this.item, "name"); //this line issue
this.item=this.uniqueArray; //this line issue
}
const result = Array.from(this.item.reduce((m, t) => m.set(t.name, t), new Map()).values());
这可能可以解决您的问题。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)