在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
这是官方给的布局代码 <view class="section"> <view class="section__title">vertical scroll</view> <scroll-view scroll-y style="height: 200px;" bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" scroll-into-view="{{toView}}" scroll-top="{{scrollTop}}"> <view ></view> <view ></view> <view ></view> <view ></view> </scroll-view> <view class="btn-area"> <button size="mini" bindtap="tap">click me to scroll into view </button> <button size="mini" bindtap="tapMove">click me to scroll</button> </view> </view> <view class="section section_gap"> <view class="section__title">horizontal scroll</view> <scroll-view class="scroll-view_H" scroll-x style="width: 100%"> <view ></view> <view ></view> <view ></view> <view ></view> </scroll-view> </view> 在文档上对css没有进行描述,要想横向滚动,首先要先把子元素设置成一行,发现float不能用 要对子元素进行display:inline-block ,容器进行 white-space: nowrap; css如下: .scroll-view_H{ width: 100%; white-space: nowrap; } .scroll-view-item_H{ width: 200px; height: 100px; display: inline-block; }
|
请发表评论