Detect Long Click In Vue.js

Install & Download:

# Yarn
$ yarn add vue-long-click
# NPM
$ npm install vue-long-click --save

Description:

A Vue.js directive used to trigger certain events on long click.

How to use it:

1. Import and register the directive.

import { longClickDirective } from 'vue-long-click'
const longClickInstance = longClickDirective({
      delay: 500, // default: 400
      interval: 60, // default: 50
})
Vue.directive('longclick', longClickInstance)

2. Basic usage.

<button v-longclick="() => CustomFunction()">+</button>

Preview:

Detect Long Click In Vue.js

Changelog:

v0.1.0 (09/04/2021)

  • fix: pass raw events to handler

Add Comment