vue监听左右滑动事件

引入 vue-touch
**1**npm insall vue-touch@next

2在main.js中将vue-touch注入到vue

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

3用vur-touch将需要滑动的包裹起来

  <v-touch v-on:swipeleft="leftChangeImg"height="500px" v-on:swiperight="leftChangeImg">
    <img :src="this.imgSrc" class="imgStyle">
    </v-touch>

猜你喜欢

转载自blog.csdn.net/weixin_39168678/article/details/81747205