bsdfzzzy/vue2-hammer
소개
Hammer.js wrapper for Vue 2.x to support some touching operation in the mobile.
웹 및 앱 개발측정된 스타 증가
- in 24h
- 0
- in 7 days
- -1
- in 15 days
- -1
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
Originalvue-hammer
Hammer.js wrapper for Vue to support some operation in the mobile
This is a directive wrapper for Hammer.js 2.x. And this repo'inspiration is from v-touch.
If you want to find a same wrapper for Angular4+, you can have a look at ngx-hammer
Install
This plugin supports Vue >= 2.0.
npm
Available through npm as vue2-hammer.
npm install vue2-hammer
import { VueHammer } from 'vue2-hammer'
Vue.use(VueHammer)
Usage
Using the v-hammer directive
<a v-hammer:tap="onTap">Tap me!</a>
<div v-hammer:swipe.left="onSwipeLeft">Swipe me!</div>
<div v-hammer:swipe.left="(event)=> onSwipeLeft(event, item, i)">Swipe me!</div>
Configuring Recognizer Options
There are two ways to customize recognizer options such as direction and threshold. The first one is setting global options:
// change the threshold for all swipe recognizers
VueHammer.config.swipe = {
threshold: 200
};
<a
v-hammer:tap="onTap"
v-hammer:pan.horizontal="onPanHorizontal"
v-hammer:panstart="onPanStart"
v-hammer:panend="onPanEnd"
v-hammer:press="onPress"
v-hammer:pressup="onPressup"
></a>
<a ></a>
<a ></a>
See Hammer.js documentation for all available events.
Supported gestures and directions
gestures
tap, pan, pinch, press, rotate, swipe
directions
up, down, left, right, horizontal, vertical, all
Note
Users can use both the gesture and the direction like v-hammer:swipe.left. But if your combination is not exist in the hammer, it is not support.
Run the Example
- Run
yarnornpm i - Run
yarn buildornpm run build - Open the index.html in the example directory.
License
관련 프로젝트 살펴보기
불러오는 중…