正确 <view class="orderOne" v-for="(item,index) in allOrderList" :key="index"> <view class="orderTop" @tap="toOrgPage(item,index)"> <image src="../../static/btn_campus.png" mode=""></image> <view class="orderNum">{{item.order.orgName ? item.order.orgName : \'\'}}{{item.order.campName ? \'(\' + item.order.campName + \')\' : \'\'}}</view> <image class="topErrow" src="../../static/back_white@[email protected]" mode=""></image> <view class="orderStatus">{{item.order.orderStatus}}</view> </view> <view class="orderLine"></view> <view class="course" v-for="(item2,index) in item.order.orderItemsList" :key="index" @tap="toOrderDetail(item2)"> <view class="img"> <image :src="item2.itemLogo" mode="aspectFill"></image> </view> <view class="courseInfo"> <view class="courseName">{{item2.itemName}}</view> <view class="subHeading">{{item2.subheading}}</view> <view class="priceName">{{item2.priceName}} {{item2.classTimeCount + \'课时\'}}</view> <view class="priceNum"> <view class="price"> <text class="priceSymbol">¥</text> {{item2.price}} </view> <view class="courseNum">x{{item2.itemNumber}}</view> </view> </view> </view>
之前, 遍历时
v-for="(item,index) in allOrderList" 没有加 index, 唯一值用的是 :key=\'item.id\', 打印大当前点击为 undefined, 加上index打印出来了!!!!
请发表评论