quasar icon indicating copy to clipboard operation
quasar copied to clipboard

QInput @change event doesn't work

Open llin55 opened this issue 8 years ago • 4 comments

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?

llin55 avatar Apr 10 '18 07:04 llin55

Explanation on proper usage: https://github.com/quasarframework/quasar/issues/1803#issuecomment-374334078

rstoenescu avatar Apr 10 '18 09:04 rstoenescu

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?

llin55 avatar Apr 10 '18 13:04 llin55

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...() }")

rstoenescu avatar May 02 '18 16:05 rstoenescu

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

ldenblyd avatar Jul 02 '19 09:07 ldenblyd