嵌套循环
test.wxml
<view wx:for="{{test}}" wx:key="" class='onearr'>
<view>姓名:{{item.name}}</view>
<view>学校:{{item.school}}</view>
<view>年纪{{item.age}}</view>
<!-- 二次嵌套循环 -->
<view wx:for="{{item.sec_test}}" wx:for-item="xxxx" wx:key="" class='secarr'>
<view >{{xxxx.desc}}</view>
</view>
</view>
test.wxss
/* //第一层数组 */
.onearr{
width: 80%;
background: orange;
}
.secarr{
width: 70%;
margin: 0 auto;
padding: 5rpx;
background: orangered;
}
test.js
test: [{
id:"001",
name: "小红",
school:"师大",
age:"18",
sec_test: [{
id: 1,
desc: "还是打比赛",
},
{
id: 2,
desc: "啥都会看见啊哈",
},
{
id: 3,
desc: "asdakjd",
}
],
},
{
id:"002",
name: "小丽",
school: "清华",
age: "22",
sec_test: [{
id: 1,
desc: "还是打比赛",
},
{
id: 2,
desc: "啥都会看见啊哈",
},
{
id: 3,
desc: "asdakjd",
}
],
}
],