小程序中实现滑块水平滑动最常用的手段是:通过scroll-view去实现;但是,通过scroll-view实现的滑动可能有时并不是我们想要达到的效果,那么,还可以通过swiper组件来实现,通过下面可进行同一个功能细节处不同的展示~
一、通过scroll-view实现滑块滑动
二、通过swiper是实现滑块滑动
wxml:
<!-- ******************* scroll-view ************************* -->
<view class="descr">用scroll-view组件实现的水平slider(滑块)</view>
<scroll-view class="scrollView" scroll-x="true">
<block wx:for="{
{scrollList}}" wx:key="">
<view class="scrollCont">{
{item.scrollCont}}</view>
</block>
</scroll-view>
<!-- ********************* swiper ******************** -->
<view class="descr">用swiper组件实现的水平slider(滑块)</view>
<!--display-multiple-items同时显示的滑块数量 -->
<swiper class="swiperView" display-multiple-items='3'>
<block w