2.1.8
https://fiddle.jshell.net/b9re3psg/
<select>
field next to "Won't fire" from 2016
to 2017
The test()
method will be called (which fires off an alert()
).
Nothing (in Internet Explorer 11). In Chrome and Firefox the test()
method is triggered as expected.
This actually has nothing to do with Vue, it's simply how IE11 behaves: https://fiddle.jshell.net/b9re3psg/1/
I had to look around for a while to find and solve this issue. Can we add this to the docs? How is it solved with v-model
?
I might be missing something, but... what about using change
event instead of input
? Do you really require input
?
@Nirazul Yes, that's what I did now. But from the docs about form input components I assumed that v-model
is _always_ syntactical sugar for :value / @input
. But on <select>
elements, this seems to not be the case.
As I said, it's working for me now, I just thought that maybe you can make this more obvious for future people with the same kind of problems.
With v2.2+ you can use any event with v-model (checkout model option)
@danieldiekmeier
Your statement is totally correct, v-model
is always syntactical sugar for :value / @input
.
It's only that IE11 doesn't fire an input
event like other browsers do.
@Nirazul But using v-model
on <select>
elements works in IE 10/11! (I tried that yesterday when I was debugging my problem.)
@danieldiekmeier Oh... 👯
@danieldiekmeier
You're right, it's in the code
But I looked around a bit where this information could be put, but am not sure there actually is a place. Probably it was just my own mistake, because it really has nothing to do with Vue. I'm fine if we just put this to rest now. 💃
Yeah, it's not obvious that @input will not work on IE11 as if v-model is just a syntax sugar for @input (to update value), I think it have to be said in docs that v-model also handles browsers compatibility better.
+1 on this. Coming from a React background where browser quirks like this are handled behind their fixed API this was a particularly frustrating behaviour to come across. I think that a good solution would either/both be:
update
that works across all field types ie select & input etc@bhoop you can try
I'm also thinking we can nicely provide this alternative facade within the VueJS eventing core with the permission of @yyx990803 .
I was able to make it work with v-model.lazy in IE11. According to the documentation this uses change event instead of input.. I couldn't make it fire with @change
and :value instead of v-model.. It is not stated anywhere that this would work with IE11. Also keep in mind b-form-select doesn't work with v-model.lazy unfortunately..
Most helpful comment
+1 on this. Coming from a React background where browser quirks like this are handled behind their fixed API this was a particularly frustrating behaviour to come across. I think that a good solution would either/both be:
update
that works across all field types ie select & input etc