Skip to content

Trigger function when clicking outside a component for Vue.js

Notifications You must be signed in to change notification settings

egoist/onclick-outside

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Trigger function when clicking outside a component for Vue.js

Resources

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published