// js 数组添加新属性和属性值
let person = _this.state.nearList;
let newArr = person.map((item, index) => {
return Object.assign(item, { distance: 100 })
}, () => {
_this.setNearList(newArr);
})
// 匹配相同的属性值
let person = this.state.roomList;
console.log( person.find(obj => obj.id == id) )
//获取拥有相同属性值的序列号
let idY= id
let inIndex;
$.each(person, function (index, value) {
if (value.id == idY) {
console.log(index);
inIndex = index
LeaseList.setIndexIn(inIndex)
}
版权声明:本文为qq_41737172原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。