zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    【应用】SVG饼状图
    【应用】图片翻转js
    userData IE
    cookie
    Local storage htm5
    全局ajax事件
    jQuery ajax序列化函数
    jQuery ajax中的get请求方法汇总
    $.ajax()
    nodejs安装错误
  • 原文地址:https://www.cnblogs.com/zhanghailing/p/12160961.html
Copyright © 2011-2022 走看看