You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Change the selected option an look at the output in <pre> element below.
What is Expected?
Selected number type should be a Number because <select> element is bound to a variable (model) and has .number modifier: <select v-model.number="perpage">.
What is actually happening?
Vue fails to cast the selected value to Number, it remains a String.
Workarounds
Some people have suggested binding the value <option :value="10">10</option>, but that's a workaround, not a fix. It's be great if the modifier worked on <select> too or at least there would be a notice in the documentation.
The text was updated successfully, but these errors were encountered:
gskema
changed the title
Model number modifier fails to cast selected value in select element.
Model number modifier fails to cast selected value of select element.
Oct 23, 2016
gskema
changed the title
Model number modifier fails to cast selected value of select element.
Model .number modifier fails to cast selected value of select element.
Oct 23, 2016
…#4022)
* support number modifier in select, radio, checkbox
* add test case
* add ASTModifier type to specify modifiers type
* fix typo
* keep code consistent
Vue.js version
2.0.3
Reproduction Link
https://jsfiddle.net/e4mxqbfv/1/
Steps to reproduce
Change the selected option an look at the output in
<pre>
element below.What is Expected?
Selected number type should be a
Number
because<select>
element is bound to a variable (model) and has.number
modifier:<select v-model.number="perpage">
.What is actually happening?
Vue fails to cast the selected value to
Number
, it remains aString
.Workarounds
Some people have suggested binding the value
<option :value="10">10</option>
, but that's a workaround, not a fix. It's be great if the modifier worked on<select>
too or at least there would be a notice in the documentation.The text was updated successfully, but these errors were encountered: