[Vuejs]-Updated select list with another – Vue.js

2👍

Your mistake is assuming the eventhandler called from onChange will get the model value passed in. It actually gets a HTMLElement change-event. So just don’t use that and use the model directly – which is updated automatically.

updateChildPartySizes: function () {
    this.maxChildPartySize = this.maxChildPartyArray.length - this.adultNumber;

I found this by first trying:

console.log(this.maxChildPartySize); // NaN

And since NaN is infectious like the plague we know that one of the two variables added together must be bad, so I logged those and and found a the event.

Also keep in mind that models (v-model="something") are two-way bindings by definition, meaning it binds :selected="foo" (one way) and v-on:change="foo" under the hood.

👤ippi

Leave a comment