<view class=‘pz’ wx:for="{{pz}}" wx:for-index=‘xb’ wx:for-item=‘value’ >
<image src=’…/…/images/{{value.img}}.jpg’></image>
{{value.name}} {{value._id}}
<!–商品数量减少 -->
<view class="{{open?‘display_showv’:‘display_none’}}" bindtap=‘subtract’ data-img=’{{value.img}}’ data-amount=’{{amount}}’ data-price=’{{value.price}}’ data-name=’{{value.name}}’>
</view>
<text class=‘bb’>你好</text>
<!–商品数量增加 -->
<view bindtap=‘add’ id=‘aa’ data-amount=’{{amount}}’ data-price=’{{value.price}}’ data-name=’{{value.name}}’ data-img=’{{value.img}}’>
</view>
</view>
wx.createSelectorQuery().select(’.bb’) 用这个不行
<text class=‘bb’>{{value.text}}</text>
bindtap=‘add’ id=‘xb’
add:function(e){
pz[e.currentTarget.id].text=‘the text’
this.setData({pz:pz})
}