@miladhp/vue-3-click-outside
v1.0.2
Published
A vue-3 composable for handle the element outside click
Downloads
6
Maintainers
Readme
@miladhp/vue-3-click-outside
- a simple, Vue.js composable for handle click outside of an element.
Installation
npm:
npm install @miladhp/vue-3-click-outside --save
yarn:
yarn add @miladhp/vue-3-click-outside --save
pnpm:
pnpm install @miladhp/vue-3-click-outside --save
Use
<template>
<div>
<div ref="myElement"></div>
</div>
</template>
<script setup>
import { useOnClickOutside } from "@miladhp/vue-3-click-outside";
const myElement = ref(null);
useOnClickOutside(myElement, () => {
console.log("Clicked outside");
});
</script>