#####有时候我们不止需要有返回键,也要有手势滑动切换页面的功能时,这个时候vue-touch就派上用场了
#####API地址:

https://github.com/vuejs/vue-touch/tree/next

#####安装

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

#####用法如下:

//html代码
<template>
  <v-touch v-on:swipeleft="swiperleft" v-on:swiperight="swiperright" class="wrapper">
	  <div class="menu-container" ref="menuContainer">    
    <!-- 这个是内容 -->  
	  </div>
  </v-touch>
</template>
export default {
  name: 'Queue',
  data () {
    return {
    
    }
  },
  methods: {
    swiperleft: function () {
      this.$router.push({'path':'/queuehistory'});
    },
    swiperright: function () {
      this.$router.push({'path':'/home'});
    }
  }

}
Logo

前往低代码交流专区

更多推荐