-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
黄书伟
committed
Aug 18, 2017
1 parent
f792fcc
commit 094fba1
Showing
2 changed files
with
55 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,54 @@ | ||
# vue-click-helper | ||
A Vue directive to distinguish between click and double click | ||
|
||
A Vue directive to distinguish between click and double click. | ||
|
||
## Introduction | ||
|
||
By default, two click interval of less than 300 ms will execute double click event, otherwise click events will execute click event | ||
|
||
|
||
# Installation | ||
``` | ||
npm i vue-click-helper -D | ||
``` | ||
|
||
# Basic Usage | ||
```javascript | ||
import Vue from 'vue' | ||
import vueClickHelper from 'vue-click-helper' | ||
|
||
Vue.directive('click-helper', vueClickHelper) | ||
|
||
export default{ | ||
|
||
methods:{ | ||
|
||
clickHelper(e,isDoubleClick){ | ||
|
||
if (isDoubleClick){ | ||
|
||
// execute double click logic... | ||
}else{ | ||
|
||
// execute normal click logic... | ||
} | ||
} | ||
} | ||
|
||
} | ||
``` | ||
|
||
```html | ||
<div v-click-helper="clickHelper">click me</div> | ||
``` | ||
|
||
# Advanced | ||
|
||
If you want to set, execute double click within 290 milliseconds,just: | ||
|
||
```html | ||
<div v-click-helper:290="clickHelper">click me</div> | ||
``` | ||
|
||
# License | ||
http://www.opensource.org/licenses/mit-license.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters