onclick-outside
v0.1.1
Published
Trigger function when clicking outside a component for Vue.js
Downloads
397
Readme
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