"children": [
{
"id": "2",
"creator": "104",
},
{
"id": "3",
"creator": "105",
},]
----------------------
<view class="content" v-for="(item,index) in newList" :key="item.id">*****</view>
<view class="more">
<text @click="change(index,item.id)">*******</text>
</view>
---------------------------
change( index, id) {
this.newCommentator = commentator
if (string == 'hotList') {
this.childrenList = this.hotList.id //这里该怎么写?
} else {
this.childrenList = this.newList.id //这里该怎么写?
}
console.log(id)
},
用find();如:
const myArr=[{id:2,name: 22},{id: 1,name: 111}];
var v=myArr.find(v=>v.id===1);
console.log(v);// {id: 1, name: 111}