uniapp禁止 swiper 手动滑动

431 阅读1分钟

如果项目有需要禁止swiper手动滑动,官方文档中未提供直接的办法。
但以下的办法可行
给每一项swiper-item里面加上@touchmove.stop=""

<swiper>
    <swiper-item @touchmove.stop="">
       <scroll-view scroll-y>
           <!-- 内容区域 -->
       </scroll-view>
    </swiper-item>
</swiper>