Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Hammer.js wrapper for Vue 2.x to support some touching operation in the mobile.

License

NotificationsYou must be signed in to change notification settings

bsdfzzzy/vue2-hammer

Repository files navigation

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 atngx-hammer

Install

This plugin supports Vue >= 2.0.

npm

Available through npm asvue2-hammer.

npm install vue2-hammer
import{VueHammer}from'vue2-hammer'Vue.use(VueHammer)

Usage

Using thev-hammer directive

<av-hammer:tap="onTap">Tap me!</a><divv-hammer:swipe.left="onSwipeLeft">Swipe me!</div><divv-hammer:swipe.left="(event)=> onSwipeLeft(event, item, i)">Swipe me!</div>

Configuring Recognizer Options

There are two ways to customize recognizer options such asdirection andthreshold. The first one is setting global options:

// change the threshold for all swipe recognizersVueHammer.config.swipe={threshold:200};
<av-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>

SeeHammer.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 likev-hammer:swipe.left. But if your combination is not exist in the hammer, it is not support.

Run the Example

  • Runyarn ornpm i
  • Runyarn build ornpm run build
  • Open the index.html in the example directory.

License

MIT

About

Hammer.js wrapper for Vue 2.x to support some touching operation in the mobile.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp