Vue-touch的使用
生活随笔
收集整理的這篇文章主要介紹了
Vue-touch的使用
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
#####有時候我們不止需要有返回鍵,也要有手勢滑動切換頁面的功能時,這個時候vue-touch就派上用場了
#####API地址:
#####安裝
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'});}}}總結
以上是生活随笔為你收集整理的Vue-touch的使用的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 重温前端基础(二) 移动WEB开发
- 下一篇: 前端知识点随记