vue项目中使用touch-left,touch-right

  • 安装

    npm install vue-touch@next --save
  • 引用

    import VueTouch from 'vue-touch'
    Vue.use(VueTouch)
  • 页面中使用

    <v-touch
      @swipeleft = "swipeLeft"
      @swiperight = "swipeRight"
      :swipe-options="{direction: 'horizontal'}"
    >
    </v-touch>
  • 函数监听
    ```
    methods:{

    swipeLeft(){},

    swipeRight(){}
    }
    ``
    :swipe-options="{direction: 'horizontal'}" 可以解决引入该组件后不许上下滑动问题

全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务