Vue 實現移動端左右滑動切換



         實現這個功能需要用到touch指令,這個是面向vue2.0的touch指令,是基於touchjs(移動端手勢庫)。

安裝以及引入vue-touch

npm install vue-touch@next --save

 



//在vue項目中的main.js文件中引入:
import VueTouch from 'vue-touch'
Vue.use(VueTouch, {name: 'v-touch'})
   2.使用vue-touch

          直接貼上實例代碼:

<v-touch v-on:swipeleft="onSwipeLeft" v-on:swiperight="onSwipeRight" >

<div class="content" >

</div>
</v-touch>

method:{ 
onSwipeLeft: function () {//左滑動},
onSwipeRight: function () {//右滑動},
}

 

————————————————
版權聲明:本文為CSDN博主「68rui」的原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/qq_41134769/article/details/89513084


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM