当前位置: 首页 > Web前端 > HTML5

vue监听手指滑动vue-touch的使用

时间:2023-04-05 21:01:03 HTML5

因为需要监听手指的左右滑动事件,所以使用了v-touch插件。npm安装npminstallvue-touch@next--save//main.js介绍:importVueTouchfrom'vue-touch'Vue.use(VueTouch,{name:'v-touch'})使用方法如下://html代码jsexportdefault{name:'Queue',data(){return{}},methods:{swiperleft:function(){安慰。log("向左滑动")},swiperright:function(){console.log("向右滑动")}}}