vue-onclick-outside

0.1.0 • Public • Published

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

/vue-onclick-outside/

    Package Sidebar

    Install

    npm i vue-onclick-outside

    Weekly Downloads

    3

    Version

    0.1.0

    License

    MIT

    Last publish

    Collaborators

    • kchan