小程序 实现横向滚动

<!-- 图片展示 -->

<scroll-view scroll-x="true" style=" width: 100%;height: 100%;white-space: nowrap;">

       <view style='display: inline-block;' wx:for='{{viewPath}}' wx:key='{{item}}'>

            <image src='{{item}}' bindtap='bigimg'></image>

            <i class='iconfont icon-ai54' bindtap='delimg'></i>

        </view>

</scroll-view>

效果如下 图片多了就横向滚动

注意:1、scroll-view scroll-x="true" style=" width: 100%;white-space: nowrap;"这些是必须要有的样式

           2、子元素 一定要加这个样式 style='display: inline-block;'

猜你喜欢

转载自blog.csdn.net/qq_37588752/article/details/83788332