vue监听手指滑动vue-touch的使用

由于需要监听手指的左右滑动事件,所以用到了v-touch这个插件。

npm安装

npm install vue-touch@next --save
//main.js中引入:
import VueTouch from 'vue-touch'
Vue.use(VueTouch, {name: 'v-touch'})

用法如下:

//html代码

js

export default {
  name: 'Queue',
  data () {
    return {
    
    }
  },
  methods: {
    swiperleft: function () {
     console.log("左划")
    },
    swiperright: function () {
     console.log("右滑")
    }
  }

}

你可能感兴趣的:(css3,vue.js,javascript,html5)