微信小程序二维for循环

转载自https://blog.csdn.net/Sensation_cyq/article/details/77507831

data: {
groups: [
 [
  {
  title: '狼图腾',
  cover: '../../img/mineBG.png'
  },
  {
  title: '狼图腾',
  cover: '../../img/mineBG.png'
  },
 ],
 [
  {
  title: '狼图腾',
  cover: '../../img/mineBG.png'
  },
 ],
 [
  {
  title: '狼图腾',
  cover: '../../img/mineBG.png'
  },
 ]
],
},

<!--一共三组-->
<view class="group" wx:for="{{groups}}"  wx:for-index="groupindex">
 
  <!--组头-->
  <view class="group-header">
    <view class="group-header-left">{{}}</view>
    <view class="group-header-right">{{}}</view>
  </view>
<br><br><br>MARK:<br>二级循环的时候,wx:for="item",这种写法是错误的。<br><br>
  <!--cell-->
  <view class="group-cell" wx:for="{{groups[groupindex]}}" wx:for-item="cell" wx:for-index="cellindex">
    <!--<image class='group-cell-image' src="{{item.cover}}"></image>-->
    <image class='group-cell-image' src="../../img/mineBG.png"></image>
    <view class='group-cell-title'>title{{cell.title}}</view>
  </view>
 
  <!--footer-->
  <view class="group-footer">{{group.footer}}</view>
</view>

原文地址:https://www.cnblogs.com/xianghuali/p/10410670.html