
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
v3-click-outside
Advanced tools
Vue3 directive to react on clicks outside an element. Its simple to use. And can Customizable boundary elements.
English | 中文
Vue3 directive to react on clicks outside an element. It is simple to use. And can Customizable boundary elements.
npm install --save v3-click-outside
import { createApp } from 'vue'
import App from './App.vue'
import clickOutside from 'v3-click-outside'
const app = createApp(App)
app.use(clickOutside)
just pass a function to the directive. The function will accept two parameters: one is a boolean which indicates whether the click is outside the element, the other is the event object.
<template>
<div v-click-outside="handleClickOustside"></div>
</template>
<script setup>
//the function accept a booleam parameter, true indicate click outside
const handleClickOustside = (isOutside, e) => {
if (isOutside) //do something
else //do something else
}
</script>
In this case, you need to pass an array which has two parameters. One is a function like above, and another is a CSS selector or a DOM element as the boundary element. The order of the arguments does not matter.
<template>
<div class="outer">
<div class="inner" v-click-outside="[handleClickOustside, '.outer']"></div>
</div>
</template>
<script setup>
//the function accept a booleam parameter, true indicate click outside
const handleClickOustside = (isOutside, e) => {
if (isOutside) //do something
else //do something else
}
</script>
FAQs
Vue3 directive to react on clicks outside an element. Its simple to use. And can Customizable boundary elements.
We found that v3-click-outside demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.