Add example of usage

This commit is contained in:
Tobias Johansson 2019-04-03 17:38:19 +02:00
parent 0b12436a31
commit 62af8c2cbf

View File

@ -1,5 +1,14 @@
// Code from https://stackoverflow.com/a/42389266
/**
* Directive to detect clicks outside of component.
* Code from https://stackoverflow.com/a/42389266
*
* @example
* <div
* v-click-outside="()=>{console.log('User clicked outside component')}"
* >
* ...
* </div>
*/
Vue.directive('click-outside', {
bind: function (el, binding, vnode) {
el.clickOutsideEvent = function (event) {