小程序 wx:for
作者:互联网
<view class="father">
<view class="row" wx:for="{{four}}" style="margin-bottom:20rpx">
<image src="../img/1.png"></image>
<view class="qw">
<view style="width:300rpx;height:110rpx; padding-left:15rpx">
{{item.cheng}}
</view>
<view style="padding-left:15rpx;font-size:30rpx;color:blue">
{{item.name}}
</view>
</view>
</view>
</view>
data: {
four:[{cheng:"青灯夜游",name:"青鬼戚容"},
{cheng:"黑水沉舟",name:"玄鬼"},
{cheng:"白衣祸世",name:"百无相"},
{cheng:"血玉探花",name:"花城"},
]
},
如果从接口获取数据的话需要用this.setData把参数添加到数据里
标签:name,获取数据,程序,four,item,戚容,cheng,wx 来源: https://blog.csdn.net/weixin_50736511/article/details/113534359