Gathering detailed insights and metrics for v-click-outside-x
Gathering detailed insights and metrics for v-click-outside-x
Gathering detailed insights and metrics for v-click-outside-x
Gathering detailed insights and metrics for v-click-outside-x
npm install v-click-outside-x
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
7 Stars
107 Commits
13 Forks
17 Branches
2 Contributors
Updated on Dec 06, 2023
Latest Version
4.1.3
Package Id
v-click-outside-x@4.1.3
Size
17.04 kB
NPM Version
6.14.6
Node Version
12.18.3
Published on
Apr 26, 2021
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
57
Vue V2 directive to react on clicks
outside an element.
1$ npm install --save v-click-outside-x
1$ yarn add v-click-outside-x
1import Vue from 'vue'; 2import * as vClickOutside from 'v-click-outside-x'; 3 4Vue.use(vClickOutside);
1<script> 2 export default { 3 methods: { 4 onClickOutside(event) { 5 console.log('Clicked outside. Event: ', event); 6 }, 7 }, 8 }; 9</script> 10 11<template> 12 <div v-click-outside="onClickOutside"></div> 13</template>
1<script> 2 export default { 3 directives: { 4 clickOutside: vClickOutside.directive, 5 }, 6 methods: { 7 onClickOutside(event) { 8 console.log('Clicked outside. Event: ', event); 9 }, 10 }, 11 }; 12</script> 13 14<template> 15 <div v-click-outside="onClickOutside"></div> 16</template>
It is not a very common need to call event.preventDefault()
, event.stopPropagation()
or
event.stopImmediatePropagation()
for click outside event handlers.
Care should be taken when using these!
The need for capture though, is reasonably common when you want menus or dropdown to behave more like their native elements.
1<template> 2 <!-- the click event´s propagation will be stopped --> 3 <div v-click-outside.stop="doThis"></div> 4 5 <!-- the click event´s default will be stopped --> 6 <div v-click-outside.prevent="doThat"></div> 7 8 <!-- modifiers can be chained --> 9 <div v-click-outside.stop.prevent="doThat"></div> 10 11 <!-- use capture mode when adding the event listener --> 12 <div v-click-outside.capture="doThis"></div> 13</template>
By default, if no argument is supplied then click
will be used. You can specify
the event type being bound by supplying an arguments, i.e. pointerdown
.
1<script> 2 export default { 3 methods: { 4 onClickOutside(event) { 5 console.log('Clicked outside. Event: ', event); 6 }, 7 }, 8 }; 9</script> 10 11<template> 12 <div v-click-outside:pointerdown="onClickOutside"></div> 13</template>
For support of the PointerEvent API, consider loading the Pointer Events Polyfill.
1<script> 2 export default { 3 methods: { 4 onClickOutside1(event) { 5 console.log('Clicked outside 1. Event: ', event); 6 }, 7 onClickOutside2(event) { 8 console.log('Clicked outside 2. Event: ', event); 9 }, 10 onClickOutside3(event) { 11 console.log('Clicked outside 3. Event: ', event); 12 }, 13 }, 14 }; 15</script> 16 17<template> 18 <div 19 v-click-outside.capture="onClickOutside1" 20 v-click-outside:click="onClickOutside2" 21 v-click-outside:pointerdown.capture="onClickOutside3" 22 ></div> 23</template>
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
50 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More