<view class="center hang array">
<block wx:for="{{indexdb}}" wx:for-index="idx" wx:for-item="list">
<view bindtap="kantie" data-id="{{list._id}}" class="placeholder interval">{{list.name}}view>
block>
view>
<view class="weui-article__h2 center hang">循环想要达到的效果view>
<view class="weui-flex center hang">
<view class="weui-flex__item"><view class="placeholder">数据1view>view>
<view class="weui-flex__item"><view class="placeholder">数据2view>view>
<view class="weui-flex__item"><view class="placeholder">数据3view>view>
view>
<view class="weui-flex center hang">
<view class="weui-flex__item"><view class="placeholder">数据4view>view>
<view class="weui-flex__item"><view class="placeholder">数据5view>view>
<view class="weui-flex__item"><view class="placeholder">view>view>
view>
给样式加上纵向排列:
display: flex;
flex-direction: column;
横向排列:
display: flex;
flex-direction: row;
<view class="center hang array">
<block wx:for="{{indexdb}}" wx:for-index="idx" wx:for-item="list">
<view bindtap="kantie" data-id="{{list._id}}" class="placeholder interval">{{list.name}}view>
block>
view>
<view class="weui-article__h2 center hang">循环想要达到的效果view>
<view class="weui-flex center hang">
<view class="weui-flex__item"><view class="placeholder">数据1view>view>
<view class="weui-flex__item"><view class="placeholder">数据2view>view>
<view class="weui-flex__item"><view class="placeholder">数据3view>view>
view>
<view class="weui-flex center hang">
<view class="weui-flex__item"><view class="placeholder">数据4view>view>
<view class="weui-flex__item"><view class="placeholder">数据5view>view>
<view class="weui-flex__item"><view class="placeholder">view>view>
view>
.hang{
margin-top: 1em;
}
.array{
display: flex;
}
.interval{
margin-left: 1rem;
}
没理解错的话,楼主咨询的是样式布局问题吧?这种可以尝试搜索一下微信小程序,列表横向排列之类的关键词。论坛里一般不太讨论样式的写法。
不知道你要干嘛,上个代码片段吧