Vue移动端实现左滑右滑

时间:2020-06-07 12:45:06   收藏:0   阅读:198

需要vue2.0以上

 

 

安装:

npm install vue-touch@next --save

main.js中引入

import VueTouch from vue-touch

Vue.use(VueTouch, {name: v-touch});

在使用的页面或插件中

  <v-touch
    @swipeleft = "swipeLeft"
    @swiperight = "swipeRight"
    :swipe-options="{direction: ‘horizontal‘}"
  >
  </v-touch>

methods:{
// 左滑 swipeLeft(){ // 页面跳转或其它操作 }, // 右滑 swipeRight(){ // 页面跳转或其它操作 }, }

 

:swipe-options="{direction: ‘horizontal‘}"  可以解决引入该组件后不许上下滑动问题

 

原文:https://www.cnblogs.com/OIMM/p/13059838.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!