本节书摘来自异步社区《微信小程序开发入门精要》一书中的第2章,第2.4节垂直折列排列,作者 李宁,更多章节内容可以访问云栖社区“异步社区”公众号查看
2.4 垂直折列排列折列和折行的方式一样,只需要加上flex-wrap:wrap即可,可以使用style属性添加,或在样式中添加,然后使用class属性引用样式。下面的代码使用style属性添加了flex-wrap:wrap。
<view class="flex-wrp" style="height: 300px;flex-direction:column; flex-wrap:wrap;">
<view class="flex-item bc_green"></view>
<view class="flex-item bc_red"></view>
<view class="flex-item bc_blue"></view>
<view class="flex-item bc_green"></view>
<view class="flex-item bc_red"></view>
<view class="flex-item bc_blue"></view>
<view class="flex-item bc_green"></view>
<view class="flex-item bc_red"></view>
<view class="flex-item bc_blue"></view>
</view>
使用上面的布局后,会看到如图2-6所示的效果。
▲图2-6 垂直折列排列从图2-6所示的效果可以看出,折列排列是在第2、3列从上到下依次排列的。