$ cnpm install vue-clickoutside
make a click outside event.
Similar vue-clickaway, but more simpler. :P
npm i vue-clickoutside -D

import Vue from 'vue'
import VueClickoutside from 'vue-clickoutside'
Vue.use(VueClickoutside)
// or custom directive id
Vue.directive('v-clickoutside', VueClickoutside)
<div v-clickoutside="show = false" class="box">
<button @click="show = true">click me</button>
<div v-show="show">dropdown</div>
</div>
If you using NPM 3.x, these will not be automatically installed.
Copyright 2013 - present © cnpmjs.org | Home |