Click Outside Tracker In Vue.js 3 – Click Away

Description:

Click Away is a Vue.js 3 directive to detect if a user clicks outside of an element.

How to use it:

1. Import and register the directive.

import VueClickAway from "vue3-click-away";
export default {
  directives: {
    ClickAway: VueClickAway,
  },
  methods: {
    onClickAway(event) {
      console.log(event);
    }
  }
}

2. Check the click outside event in an element you specify.

<template>
  <div v-click-away="onClickAway">
    ...
  </div>
</template>

Preview:

Click Outside Tracker In Vue.js 3 - Click Away

Download Details:

Author: VinceG

Live Demo: https://github.com/VinceG/vue-click-away#demo

Download Link: https://github.com/VinceG/vue-click-away/archive/master.zip

Official Website: https://github.com/VinceG/vue-click-away

Install & Download:

# Yarn
$ yarn add vue3-click-away

# NPM
$ npm i vue3-click-away --save

You Might Be Interested In:

Add Comment