多个wx:for循环的如何使用?

发布于 7 年前作者 xiuying4412690 次浏览最后编辑 7 年前来自 issues

<block wx:for=“{{time1}}” wx:key=“{{time1}}”>

    <block wx:for=“{{item.time2}}” wx:key=“{{time2}}”>

        <view>{{index}}</view>

    </block>

</block>

假如数组time2是数组time1中的一个值,那么在view中,怎么要想调用数组time1下的其他值,该怎么调用?比如想在view中调用time1的index

6 回复
fyuan
fyuan2 楼6 年前

用wx:for-item=“item2"和wx:for-index=“index2"定义第二个wx:for=”{{item.time2}}” 的item和index

yanjing
yanjing3 楼6 年前

wx:for-index起个别名,一个for的默认是index,多个嵌套时建议起别名,还有子项默认为item,建议wx:for-item=‘’,起个别名

taomeng
taomeng4 楼6 年前

wx:for-item

vxiao
vxiao5 楼6 年前

你这种嵌套的block渲染出来的顺序有问题吗?

juan41
juan416 楼5 年前

用wx:for-item  和 wx:for-index 定义里面的item和index