[Vuejs]-Custom vue events not working

0šŸ‘

Iā€™m not sure if this is a Vue way of dealing with it, but it works in my JSFiddle. Simply call myEventFunc() from within clickedFunc:

new Vue({
  el: "#app",
  data: {
    myEvent: false,
    clicked: false,
  },
  methods: {
    myEventFunc: function() {
      this.myEvent = true;
    },
    clickedFunc: function() {
      this.clicked = true;
      this.myEventFunc();
      this.$emit('myevent');
    }
  }
})

Leave a comment