onclick-outside

Trigger function when clicking outside a component for Vue.js
3,596 21
Install
npm install onclick-outside
Latest Version:0.1.1
License:MIT
Last Updated:Dec 25, 2021
Links: GitHub  ·  npm
Maintainer: kchan

onclick-outside

Trigger function when clicking outside a component for Vue.js

Vue 2.0 compatible, see demo: https://egoistian.com/onclick-outside

Install

$ npm install --save onclick-outside

Usage

<template>
  <click-outside :handler="handleClickOutside">
    <button>don't click me, click outside!</button>
  </click-outside>
</template>

<script>
  import ClickOutside from 'onclick-outside'

  export default {
    methods: {
      handleClickOutside(e) {
        console.log('hey, why did you touch outside?')
      }
    },
    components: {
      ClickOutside
    }
  }
</script>

License

MIT © EGOIST

Related Packages

focus-outside

📦 A good clickOutside library, and it solves the problem that iframe cannot tri...

9,573 93
clickout-lite

A lightweight utility to detect outside clicks on elements — compatible with Vue...

3,246 0
vue

The progressive JavaScript framework for building modern web UI.

468,054,189 54,906
vue
eslint-plugin-vue

Official ESLint plugin for Vue.js

266,364,830 4,591

Version History

Version Released License
0.1.1 MIT
0.1.0 MIT