<block wx:for="{{listData}}" wx:for-item="item" wx:key="index">
<block wx:for="{{item.tupian}}" wx:for-item="items" wx:for-index="indexs">
<navigator url="../news/show?id={{item.id}}">
<view class="xiutu-view">
<image class='xiutu-thumb' mode="aspectFill" src="{{items}}" />
</view>
</navigator>
</block>
</block>
这是循环代码,下面是listData打印的数据
下面是单条数据的打印结果
author: "图王"
favorites: "1"
guanzhu: 0
hits: "12"
id: "9"
isfavorite: null
keywords: (2) ["风景图片", "手机壁纸"]
support: "2"
thumb: "https://www.xiutuweb.com/uploadfile/ueditor/image/202107/1626765101690739.jpg"
title: "漂亮海边背景图片壁纸"
tupian: (8) [
"https://www.xiutuweb.com/uploadfile/ueditor/image/202107/16267651016d9d40.jpg",
"https://www.xiutuweb.com/uploadfile/ueditor/image/202107/1626765101ad3c10.jpg",
"https://www.xiutuweb.com/uploadfile/ueditor/image/202107/1626765101929323.jpg",
"https://www.xiutuweb.com/uploadfile/ueditor/image/202107/16267651010aea2f.jpg",
"https://www.xiutuweb.com/uploadfile/ueditor/image/202107/1626765101990adc.jpg",
"https://www.xiutuweb.com/uploadfile/ueditor/image/202107/1626765101bdf2b1.jpg",
"https://www.xiutuweb.com/uploadfile/ueditor/image/202107/1626765101690739.jpg",
"https://www.xiutuweb.com/uploadfile/ueditor/image/202107/1626765101dea9a8.jpg"
]
现在是出来之后
感觉每一条的循环tupian这个数组时,都会从第一条的下标0开始,所以就重复了。请问这是什么原因?
你确定你的数据没有重复的?
我觉得可能是数据重复的可能性偏大,可以用去重验证一下每个{{listData}}里的{{tupian}}是否有完全重复都数据,如果还是有问题 建议弄一个代码复现 让大家康康 帮你瞅瞅问题
外层又5个内层有8个,循环5*8,先查询一下外层里面的图片数组图片是否都是一样的
然后删除第一层的wx:for-item="item" 默认第一次无需添加这个定义item为默认