<scroll-view scroll-x class="moduleView">
<view class="modulItemView">1</view>
<view class="modulItemView">2</view>
<view class="modulItemView">3</view>
</scroll-view>
仅仅设置 scroll-x无法实现横向排列和滑动?还需在scroll-view和子view的wxss样式里进行如下设置
.moduleView {
white-space:nowrap;
}
.modulItemView{
display: inline-block;
}
如果想在子view里使用 弹性布局 display:flex ,也可以这样:
<scroll-view scroll-x class="moduleView">
<view style="display:flex; flex-direction:row;">
<view class="modulItemView">1</view>
<view class="modulItemView">2</view>
<view class="modulItemView">3</view>
</view>
</scroll-view>
.moduleView {
white-space:nowrap;
}