onclick-outside: Trigger function component for Vue.js

onclick-outside

A Trigger function component when you would like something to happen after you have clicked outside of a Vue.js Component.

Install

$ npm install --save onclick-outside

Usage

<template>
  <click-outside :handler="handleClickOutside">
    <button>Click outside of this component</button>
  </click-outside>
</template>

<script>
  import ClickOutside from 'onclick-outside'

  export default {
    methods: {
      handleClickOutside(e) {
        console.log('touched outside?')
      }
    },
    components: {
      ClickOutside
    }
  }
</script>

Github repository

Check out the Live Demo