SachinYe 2023-02-06 20:55 采纳率: 100%
浏览 23
已结题

uniapp 遍历无法读取index

无法读取index
<view class="floor-list">
    <view
        class="floor-item"
        v-for="item in floorList"
        :key="item.floor_title.name">
        <image
            class="floor-title"
            :src="item.floor_title.image_src"></image>
        <view class="floor-img-box">
            <view class="right-img-box">
                <image
                    :src="item.product_list[0].image_src"
                    :style="{ width: item.product_list[0].image_width + 'rpx' }"
                    mode="widthFix"></image
            ></view>
            <view class="left-img-box">
                <image
                    v-for="(item2, i) in item.product_list"
                    :key="item2.name"
                    v-if="i !== 0"
                    :src="item2.image_src"
                    :style="{ width: item2.image_width + 'rpx' }"
                    mode="widthFix"></image>
            </view>
        </view>
    </view>
</view>

img


源码地址
https://gitee.com/sachin-ye/uni-app-ts

  • 写回答

3条回答 默认 最新

  • CSDN专家-showbo 2023-02-06 21:50
    关注

    不显示第一个对数组slice截取需要的数据进行遍历

        <image v-for="(item2, i) in item.product_list.slice(1)"
           :key="item2.name"
           :src="item2.image_src"
           :style="{ width: item2.image_width + 'rpx' }"
           mode="widthFix"></image>
    
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

问题事件

  • 系统已结题 2月15日
  • 已采纳回答 2月7日
  • 创建了问题 2月6日