[Vuejs]-How to pass more than just the new value in a change event on an input?

3👍

The v-on directive provide a $event object with the value emitted, so you can use it in template to call the event handler with additional params:

<b-input type="text" @change="onFieldChanged($event, field.fieldName)" :placeholder="field.fieldName"></b-input>

And:

methods: {
  onFieldChanged (val, fieldname) {
    // send val to the state to put it in the form object
  }
}

Leave a comment