Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/huangshuwei/vue-click-helper

A Vue directive to distinguish between click and double click
https://github.com/huangshuwei/vue-click-helper

click dblclick doubleclick vue-directive vue2

Last synced: 26 days ago
JSON representation

A Vue directive to distinguish between click and double click

Lists

README

        

# vue-click-helper

Vue2.x directive to handle click event and dblclick event on same element

## 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

```html

click me

```

```javascript
import Vue from 'vue'
import vueClickHelper from 'vue-click-helper'

export default{
directives: {
'click-helper': vueClickHelper
},
methods:{

clickHelper(e,isDoubleClick){

if (isDoubleClick){

// execute double click logic...
}else{

// execute normal click logic...
}
}
}

}
```

# Advanced

If you want to set, execute double click within 290 milliseconds,just:

```html

click me

```

# License
http://www.opensource.org/licenses/mit-license.php