🔔 Alert..!! Get 2 Month Free Cloud Hosting With $200 Bonus From Digital Ocean ACTIVATE DEAL

This component allows you to trigger a function when clicking outside a component for Vue.js 1.x/2.x.

Other

Documentation

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>

FAQ

Not work on iOS, etc?

See https://github.com/kentor/react-click-outside#not-working-on-ios

License

MIT © EGOIST


You May Also Like