Quasar: QInput @change event doesn't work

Created on 10 Apr 2018  路  4Comments  路  Source: quasarframework/quasar

Software version

Quasar: 0.15.10
OS:
Node:
NPM:
Browsers:
iOS:
Android:
Any other software related to your bug:

JsFiddle (for Quasar v0.15+ only)

https://jsfiddle.net/2skym112/

What did you get as the error?

QInput does not emit @change events - please see the example code above

What were you expecting?

What steps did you take, to get the error?

Most helpful comment

You're using v-model. This is equivalent to :value="model" @input="(newVal) => model = newVal".
So, as a result, @change does not gets called, since @input is emitted first, changes the model, then Quasar components emits @change only if model is different than the value being emitted... and since @input from v-model already updated the model, the value is same as the one emitted, so the @change event is skipped.

Either use:

  1. v-model along with @input
  2. The "lazy" equivalent of v-model (:value="model" @change="(newVal) => { model = newVal; callSomething...() }")

All 4 comments

I don't see how this explanation is related to the issue. The problem that the @change event is NOT being envoked at all, doesn't matter whatever function we define there.

Have you seen my fiddle example?

You're using v-model. This is equivalent to :value="model" @input="(newVal) => model = newVal".
So, as a result, @change does not gets called, since @input is emitted first, changes the model, then Quasar components emits @change only if model is different than the value being emitted... and since @input from v-model already updated the model, the value is same as the one emitted, so the @change event is skipped.

Either use:

  1. v-model along with @input
  2. The "lazy" equivalent of v-model (:value="model" @change="(newVal) => { model = newVal; callSomething...() }")

dont forget to change 'v-model' props into ':value'.
https://jsfiddle.net/2nfkes79/

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mesqueeb picture mesqueeb  路  3Comments

fnicollier picture fnicollier  路  3Comments

slowaways picture slowaways  路  3Comments

jippy89 picture jippy89  路  3Comments

jean-moldovan picture jean-moldovan  路  3Comments