[Vuejs]-Vue conditional event binding with arguments

0👍

You actually have to define the the $event argument by yourself (use a arrow function for example):

v-on="{ change: data.hasButton ? ($event) => watchChange(data, $event) : null }"

0👍

watchChange(event) {
    if(!this.data.hasButton)
        return;
    console.log(event)
    console.log(this.data);
}

Then you can bind it like this v-on="watchChange"

Leave a comment