vue-touch监听手指左滑右滑事件

1、下载

npm install vue-touch@next --save

2、main.js中引入

import VueTouch from 'vue-touch'
Vue.use(VueTouch, { name: 'v-touch' })

3、使用,tag渲染成什么标签,默认渲染成div。click事件要改为tap事件

    <v-touch tag='p' @swipeleft="swiperleft" @swiperight="swiperright" @tap='handleClick'>
      1234565
    </v-touch>
    swiperleft: function () {
      console.log('左划')
    },
    swiperright: function () {
      console.log('右滑')
    },
    handleClick() {
      console.log('点击')
    }

 

posted @ 2021-06-04 14:32  吴小明-  阅读(1301)  评论(0编辑  收藏  举报