关于scroll-view的横向滚动的设置

scroll-view 组件设置scroll-x为true

  <view class="container">
      <scroll-view scroll-x=true>
          <view class="box"></view>
      </scroll-view>
  </view>

scroll-view 组件的父组件样式设置为 white-space: nowrap;
需要横向滚动的子组件设置为 display: inline-block;

  .container {
    white-space: nowrap;
  }
  .box {
    display: inline-block;
  }

为了对齐,最好加上样式

 .box {
    vertical-align: top;
 }
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。