simplesmiler / vue-clickaway

Reusable clickaway directive for reusable Vue.js components
MIT License
963 stars 77 forks source link

thx, big work for me #42

Open blstdmi opened 5 years ago

blstdmi commented 5 years ago

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
          }

        },
blstdmi commented 5 years ago

add for fix..

          if (this.checked){
            console.log(event)
            this.checked = 0
            if(event.target.getAttribute("for")== "checkbox-menu")

            this.checked = 1
          }
blstdmi commented 5 years ago

but maybe change code to https://codepen.io/lerte/pen/XgqrOr