├── .gitignore ├── package.json ├── webpack.config.js ├── example.html ├── README.md ├── dist └── vue-gesture.js └── vue-gesture.js /.gitignore: -------------------------------------------------------------------------------- 1 | .git 2 | node_modules/ 3 | npm-debug.log 4 | selenium-debug.log 5 | package-lock.json 6 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-gesture", 3 | "version": "2.0.0", 4 | "description": "gestures events plugin for Vue.js", 5 | "main": "vue-gesture", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "dev": "webpack-dev-server --inline --hot", 9 | "build": "webpack" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "git+https://github.com/mlyknown/vue-gesture.git" 14 | }, 15 | "author": "mlyknwon", 16 | "license": "MIT", 17 | "bugs": { 18 | "url": "https://github.com/mlyknown/vue-gesture/issues" 19 | }, 20 | "homepage": "https://github.com/mlyknown/vue-gesture#readme", 21 | "devDependencies": { 22 | "webpack": "^1.12.14", 23 | "webpack-dev-server": "^1.14.1" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | var webpack = require('webpack'); 4 | var uglifyJsPlugin = webpack.optimize.UglifyJsPlugin; 5 | // var HtmlWebpackPlugin = require('html-webpack-plugin'); 6 | //var OpenBrowserPlugin = require('open-browser-webpack-plugin'); 7 | 8 | module.exports = { 9 | entry: './vue-gesture.js', 10 | output: { 11 | path:'./dist', 12 | filename: 'vue-gesture.js' 13 | }, 14 | plugins: [ 15 | new uglifyJsPlugin({ 16 | compress: { 17 | warnings: false 18 | }, 19 | except: ['$super', '$', 'exports', 'require'] //排除关键字 20 | }), 21 | // new HtmlwebpackPlugin({ 22 | // title: 'vue-gesture' 23 | // }), 24 | /*new OpenBrowserPlugin({ 25 | url: 'http://localhost:8080' 26 | })*/ 27 | ] 28 | }; -------------------------------------------------------------------------------- /example.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | touchstart 21 | touchmove 22 | touchend 23 | tap 24 | doubleTap 25 | longTap 26 | swipe 27 | swipeLeft 28 | swipeRight 29 | swipeUp 30 | swipeDown 31 | click 32 | 33 |
34 | 35 | 36 | 55 | 56 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vue-gesture 2 | 3 | > **Vue-Gesture** is a simple Vue.js gesture events plugin. 4 | >It runs now under Vue.js 2, which comes from a fork, to see here: https://github.com/bees4ever/vue2-gesture. The old version for Vue.js 1 is not longer available. 5 | See the example for how to use this plugin, simply it's now a component and not a directive anymore. 6 | There are a bunches of arguments you can use, i.e. tap, swipe, touchstart etc. 7 | When you are in the use of the PC,"tap, longtap, touchstart" will automatically be converted to "click". 8 | 9 | - tap — fires when the element is tapped. 10 | - doubleTap — this pair of events can be used to detect double taps on the same element 11 | - longTap — fires when an element is tapped and the finger is held down for more than 750ms. 12 | - swipe, swipeLeft, swipeRight, swipeUp, swipeDown — fires when an element is swiped 13 | - touchstart touchmove touchend click- These equivalent to touch the primary event 14 | 15 | 16 | ## Install 17 | 18 | #### CommonJS 19 | 20 | The updated version is available through npm as `vue2-gesture`. So simply run `npm install vue2-gesture`. Then you can use it as follows: 21 | 22 | ``` js 23 | // You may use: 24 | window.Vue = Vue; 25 |  var VueGesture = require('vue2-gesture') 26 | Vue.use(VueGesture) 27 | ``` 28 | 29 | #### Direct include 30 | 31 | You can also directly include it with a `