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){}
  • 相关阅读:
    mass Framework spec模块 v2
    素数判断算法(高效率)
    修改Win7远程桌面端口【适用XP/2003】
    一步一步写算法(之hash表)
    DropdownList绑定的两种方法
    JDK1.5官方下载_JDK5官方下载_JDK1.5API(chm)下载_JDK5APICHM中文参考下载_JDK1.5下载_JDK5下载
    HTTPS 方式访问网站
    薏米红豆粥功效及做法介绍
    教你用笔记本破解无线路由器密码
    HTTPS那些事(一)HTTPS原理
  • 原文地址:https://www.cnblogs.com/520BigBear/p/11328593.html
Copyright © 2011-2022 走看看