wxml

    1. <view class="lis1" wx:for="{{materialList}}" wx:key="{{index}}">
    2. <view class="lis1_left wxellipsis">{{item.name}}</view>
    3. <view class="lis1_right">
    4. <view wx:for="{{item.lis}}" wx:key="*this" wx:for-item="itemList" wx:for-index="indexList" class="lis1_rightLis wxellipsis {{item.choose == indexList ? 'lis1_rightLisDe' : '' }}" data-item = '{{item}}' data-index = '{{index}}' data-listIndex = "{{indexList}}" bindtap="cailiao">{{itemList}}</view>
    5. </view>
    6. </view>

    js

    1. data: {
    2. materialList: [
    3. {
    4. name: '板材',
    5. choose: 0,
    6. lis: ['3.00', '1.20', '1.00', '1.80', '全部']
    7. },
    8. {
    9. name: '材质',
    10. choose: 0,
    11. lis: ['FR-4', 'CEM-1', 'FR-1', '铝基板', '全部']
    12. },
    13. {
    14. name: '铜厚',
    15. choose: 0,
    16. lis: ['H/0', '1/0', 'H/H', '1/1', '全部']
    17. },
    18. {
    19. name: '品牌',
    20. choose: 0,
    21. lis: ['建滔', '招远', '国纪', '航宇', '全部']
    22. }
    23. ]
    24. },
    25. //choose 这个东西是自定义拿到后添加进去的作为标识
    26. //通过修改choose去更新点击的事件 如果有进一步的操作可以先请求要的数据在更新
    27. cailiao(e) {
    28. console.log(e)
    29. let index1 = e.target.dataset.index;
    30. this.setData({
    31. ['materialList[' + index1 + '].choose']: e.target.dataset.listindex
    32. })
    33. },