vue-clickaway
vue-clickaway copied to clipboard
thx, big work for me
can you record a video of how the main mechanism works? how the plugin works.. as it was written.. can be explain to on what occupations https://scrimba.com
I use the code for the checkbox menu thx!
<input v-model="checked" type="checkbox" id="checkbox-menu">
<label for="checkbox-menu">checkbox menu</label>
<div v-on-clickaway="away" class="menu_elements"> .... </div>
mixins: [ clickaway ],
name: "bodyfooter",
data(){return{
checked: false
}
},
methods: {
away: function() {
// console.log('clicked away');
//this.checked = !this.checked
if (this.checked){
this.checked = 0
}
},
add for fix..
if (this.checked){
console.log(event)
this.checked = 0
if(event.target.getAttribute("for")== "checkbox-menu")
this.checked = 1
}
but maybe change code to https://codepen.io/lerte/pen/XgqrOr