wx:for
项的变量名默认为 item
wx:for-item
指定数组当前元素的变量名
下标变量名默认为 index
wx:for-index
指定数组当前下标的变量名
<block wx:for="{{arr}}" wx:key="{{index}}">
<view>{{index}}:{{item}}</view>
</block>
data: {
arr:["苹果🍎"," 香蕉🍌","西瓜🍉"]
},
<view class="cu-avatar round lg bg-{{item.name}} margin-xs" wx:for="{{ColorList}}" wx:key>
<text class='avatar-text'>{{item.name}}</text>
</view>
data: {
ColorList: app.globalData.ColorList,
},