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){}
  • 相关阅读:
    114自定义UITableViewCell(扩展知识:为UITableViewCell添加动画效果)
    101在检索框中添加一个书签按钮(扩展知识:在检索框中添加一个范围条)
    088实现自动倒计时功能
    086设置日期选择器框的显示样式
    Shell if else
    Shell数组
    Shell字符串
    Shell运算符
    数据挖掘标准流程规范
    Shell转义字符与变量替换
  • 原文地址:https://www.cnblogs.com/520BigBear/p/11328593.html
Copyright © 2011-2022 走看看