如果数据是这样的:
userInformation:{
'aa':{
user_name:'ddd123',
icon:'',
pic:'',
addTime:'2018-3-21 11:21',
content:'kkdkdkdk',
predict:1,
like:true,//标注是点赞还是回复
},
'bb':{
user_name:'ddd123',
icon:'',
pic:'',
addTime:'2018-3-21 11:21',
content:'kkdkdkdk',
predict:1,
like:false,
},
'cc':{
user_name:'ddd123',
icon:'',
pic:'',
addTime:'2018-3-21 11:21',
content:'kkdkdkdk',
predict:1,
like:false,
}
}
如果需要遍历到dom里面,按照遍历数组的方式遍历就好了
<div class="twitsWatchlistItem" v-for="(item,key,index) in userInformation"> <div>{{item.user_name}}--{{key}}--{{index}}</div><!--第一个值是value,第二个值是key,第三个值是索引--> </div>
效果: