vue-click-outside-hook
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

vue-click-outside-hook

A hook function triggered when clicking outside the component, used like lifecycle hooks.

Install

use yarn

yarn add vue-click-outside-hook

or use npm

npm install vue-click-outside-hook

Usage

for Vue 3.x use onClickOutside in setup()

<script>
import { defineComponent } from 'vue'
import onClickOutside from 'vue-click-outside-hook';
 
export default defineComponent({
  setup() {
    onClickOutside(e => {
      // after clicking outside the component
      // this callback will be triggered
    })
  }
})
</script>

Dependencies (1)

Dev Dependencies (19)

Package Sidebar

Install

npm i vue-click-outside-hook

Weekly Downloads

17

Version

1.0.3

License

MIT

Unpacked Size

6.9 kB

Total Files

11

Last publish

Collaborators

  • liuycy