Vue移动端左滑右滑


使用的组件地址:https://github.com/vuejs/vue-touch/tree/next

注:vue2.0以上

1、安装

npm install vue-touch@next --save

 

2、main.js中引入  

import VueTouch from 'vue-touch'

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

 

3、在使用的页面中

  <v-touch
    @swipeleft = "swipeLeft"
    @swiperight = "swipeRight"
    :swipe-options="{direction: 'horizontal'}"
  >
  </v-touch>
methods:{
// 左滑 swipeLeft(){ // 页面跳转或其它操作 }, // 右滑 swipeRight(){ // 页面跳转或其它操作 },
}

注:

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

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM