微信小程序实现商品详情页规格选择功能

微信小程序实现商品详情页规格选择功能
图片描述

要实现点击版本版本对应选项选中,点击颜色对应颜色选项选中

<view class='chosebox' wx:for="{{chose}}" wx:for-item="property" wx:key="index2" wx:if="{{chose.length>0}}">

  <text class='ctil'>{{property.name}}</text>
  <view class='chose'>
    <view wx:for="{{property.childsCurGoods}}" wx:for-item="item2" wx:key="index">
      {{item2.name}}
    </view>
  </view>
</view>
阅读 6.7k
1 个回答
<view wx:for="{{menu}}" class="{{activeIndex == index ? 'active':''}}" wx:for-item='menuName' wx:for-index='index' data-index='{{index}}' data-msg='{{menuName}}' wx:key='item' catchtap="clickMenu">

    <text>{{menuName.name}}</text>
</view>

clickMenu: function (event) {
        var index, id;
        var tempObj = event.currentTarget.dataset;
        index = tempObj.index;
        id = tempObj.msg.id;
        this.setData({
            activeIndex: index,
            tempKey: id
        })
    },
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题