Vue 实现移动端左右滑动切换


         实现这个功能需要用到touch指令,这个是面向vue2.0的touch指令,是基于touchjs(移动端手势库)。

安装以及引入vue-touch

npm install vue-touch@next --save



//在vue项目中的main.js文件中引入:
import VueTouch from 'vue-touch'
Vue.use(VueTouch, {name: 'v-touch'})
   2.使用vue-touch

          直接贴上实例代码:

<v-touch v-on:swipeleft="onSwipeLeft" v-on:swiperight="onSwipeRight" >

<div class="content" >

</div>
</v-touch>

method:{ 
onSwipeLeft: function () {//左滑动},
onSwipeRight: function () {//右滑动},
}

————————————————
版权声明:本文为CSDN博主「68rui」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_41134769/article/details/89513084

原文地址:https://www.cnblogs.com/zhanghailing/p/12160961.html