const find_index = this.goods_list_data.findIndex((val,index)=>{
return val.radios.map((item2, index2) => {
console.log(item2,'item2')
console.log(item2.name,'item2.name')
item2.name = this.orde_data_obj.price_name
})
})
this.goods_list_data 这是我的一个数组对象,里面有一个radios数组对象,
我想找到radios数组对象中的name 和 this.orde_data_obj.price_name 相等的索引,
请问如何去写?谢谢大家
let find_index = ''
this.goods_list_data.map((item, index) => {
find_index = item.radios.findIndex((val,index2)=>{
return val.name == this.orde_data_obj.price_name
})
})
console.log(find_index,'find_index')
我自己用这个方法试了下,好像可以找到了, 但是总感觉没别人写的好,请问是不是能写的更简单好点?谢谢
你想要的是这种吗