实现这个功能需要用到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

相关文章:

  • 2021-10-31
  • 2022-12-23
  • 2021-11-17
  • 2021-11-06
  • 2022-12-23
  • 2022-12-23
  • 2021-10-16
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-11
  • 2022-12-23
  • 2021-08-15
相关资源
相似解决方案