使用 wx:for-item 可以指定数组当前元素的变量名,
使用 wx:for-index 可以指定数组当前下标的变量名:
<swiper current='{{currentTab}}' duration='300' bindchange='swiperTab'>
<swiper-item wx:for="{{content}}" wx:key="index">
<textarea class="buy-detail" maxlength="140" placeholder-class="textarea-placeholder" placeholder="{{item.txt}}"></textarea>
<view class="buy-what" >
<view class="buy-what-item" wx:for="{{item.tip}}" wx:key="index" wx:for-item="newitem">{{newitem.name}} </view>
</view>
</swiper-item>
</swiper>
content:[
{txt:"想买什么买什么,请填写商品名称和数量",tip:[{name:"+香烟"},{name:"+早餐"},{name:"+宵夜"},{name:"+胶带"},{name:"+纸巾"},{name:"+电池"}]},
{ txt: "输入商品名称以及要求,如:全家桶一个",tip:[{name:"+肯德基"}, {name:"+早餐"}, {name:"+宵夜"}, {name:"+胶带"}, {name:"+纸巾"},{name: "+电池"}]},
{ txt: "请填写咖啡奶茶品类、口味、杯型等具体要求",tip:["+小杯", "+早餐", "+宵夜", "+胶带", "+纸巾", "+电池"]}
]
网友评论