Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
黄书伟 committed Aug 18, 2017
1 parent f792fcc commit 094fba1
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 3 deletions.
54 changes: 53 additions & 1 deletion README.md
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
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "vue-clickhelper",
"name": "vue-click-helper",
"version": "0.0.1",
"description": "A Vue directive to distinguish between click and double click",
"main": "dist/vue-clickhelper",
"main": "dist/clickHelper",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
Expand Down

0 comments on commit 094fba1

Please sign in to comment.