zoukankan      html  css  js  c++  java
  • 小程序多重遍历==小程序遍历数组中的数组

    代码:  遍历 modelList 数组套数组

    <view class='modelitem' wx:for="{{modelList}}" data-order='{{item.name}}' wx:key>
                <view class='modelitemTitle' bindtap='modelitemTitle' data-index="{{index}}">{{item.name}}</view>
                <block wx:if="{{item.shows}}">
                  <view class='modelitem_item' bindtap='modelitem_item' data-name='{{itemTwo.name}}' data-model='{{itemTwo.id}}' wx:for="{{item.shopTruckModelEntityList}}" wx:key wx:for-item="itemTwo">
                    {{itemTwo.name}}
                  </view>
                </block>
              </view>


    //小知识:(获取自定义属性)
    modelitemTitle(e){
      console.log(e.currentTarget.dataset.index
    }



    区分 vue自定义属性
    
    <ul class="homeList">
                        <li v-for="(item, index) of homeList" 
                            :key="index"
                    :id="item.id" @click="homeListClick(index,item.id)" :class="{ 'bgcTwo': item.type!=1, 'bgcOneSelected': item.type==1&&(homeTicketIndex==index), 'bgcTwoSelected': item.type!=1&&(homeTicketIndex==index) }"> <div class="homeItemTop" :class="{'whiteColor':homeTicketIndex==index}"> <img src="./img/dui.png" v-if="homeTicketIndex==index" alt=""> <img src="./img/yuan.png" v-if="homeTicketIndex!=index" alt=""> <p v-if="item.type==1" :class="{'whiteColor':homeTicketIndex==index}">{{item.name}}</p> <p style="font-size:.88rem" :class="{'whiteColor':homeTicketIndex==index}" v-if="item.type!=1">{{item.dAmount}}<span>元 × {{item.countUsed}}张</span></p> </div> <p v-if="item.type==1" :class="['homeItemtitle',{'whiteColor':homeTicketIndex==index}]">222</p> <p v-if="item.type!=1" :class="['homeItemtitle',{'whiteColor':homeTicketIndex==index}]">222</p> <p :class="['timeLimit',{'whiteColor':homeTicketIndex==index}]">2</p> <div class="homeListBtn">{{item.price}}元购买</div> </li> </ul>

    直接函数拿:
    homeListClick(index,item.id){}
  • 相关阅读:
    只使用代码创建WPF程序
    C#第一课
    VMware虚拟机的网络设置
    mac系统下配置Eclipse Java/C++ 开发环境
    【读书笔记】【物联网】《物物连起大世界物联网的应用与前景》
    移动硬盘无法格式化
    Win7下chm文件打不开的解决办法[转]
    MapInfo数据到ARCGIS数据Shapefile的转换
    mapx不具开发功能
    [读书笔记]熟悉SQLPLUS Oracle数据库环境
  • 原文地址:https://www.cnblogs.com/520BigBear/p/11328593.html
Copyright © 2011-2022 走看看