支持vue2.0的面向指令的touch指令,基于touchjs(原百度实现的移动端手势库)
vue-touchjs支持三种stopPropagation的方式:
1 .stop修饰符
2 事件handler里面调用stopPropagation方法
3 事件handler里面return false
支持的事件:
tap
pinchstart
pinch
pinchend
pinchin
pinchout
rotate
rotateleft
rotateright
swipestart
swiping
swipendf
swiperight
swipeleft
swipeup
swipedown
swipe
drap
drapstart
drapend
hold
doubletap
其中tap是模拟点击事件,pinch 模拟双指缩放,rorate是模拟旋转手势,swipe模拟快速滑动,drap模拟拖拽,hold表示长按,doubletap模拟双击。
使用:
vue2.0之后的要使用next分支才行,之前的使用master分支即可
npm install vue-touch@next --save
import VueTouch from 'vue-touch'
Vue.use(VueTouch,{name:'v-touch'});
使用方法:
<!-- Renders a div element by default --> <v-touch v-on:swipeleft="onSwipeLeft">Swipe me!</v-touch> <!-- Render as other elements with the 'tag' prop --> <v-touch tag="a" v-on:tap="onTap">Tap me!</v-touch>
github地址:https://github.com/vuejs/vue-touch/tree/next
发表评论
侧栏公告
寄语
譬如朝露博客是一个分享前端知识的网站,联系方式11523518。
热评文章
标签列表
热门文章
友情链接