小程序横向滚动

 
<scroll-view scroll-x class="scroll-header">
<view id="green" class="scroll-view-item bc_green"></view>
<view id="red" class="scroll-view-item bc_red"></view>
<view id="yellow" class="scroll-view-item bc_yellow"></view>
<view id="blue" class="scroll-view-item bc_blue"></view>
<view id="blue" class="scroll-view-item bc_blue"></view>
<view id="blue" class="scroll-view-item bc_blue"></view>
<view id="blue" class="scroll-view-item bc_blue"></view>
<view id="blue" class="scroll-view-item bc_blue"></view>
</scroll-view>

 主要是css

.scroll-header{
display: flex;
white-space: nowrap;  这个很重要,
}
.scroll-header view{
height:128rpx;
width:128rpx;
border:1px solid red;
display: inline-block; 这个也很重要
}
 

小程序横向滚动

上一篇:微信小程序-bug-调用wx.login()无响应的原因和解决方案


下一篇:1. 微信公众号申请