-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[V1] QInput type="number" returns string instead of number for model #3924
Comments
Thanks for reporting this. Will get it fixed. |
Prior to a thorough investigation, I recommend using: |
Oh, I didn't know that. I'll try it. Thanks. |
This is the recommended usage going forward. |
What would be the best way in the case of one-way binding? E.g., |
@topvis That's not one-way binding. That's the rough equivalent of |
@rstoenescu I had to use the @input event because the data is actually in a Vuex store and I need to call a Vuex mutation function to update the data. I assume this is a very common way when using Vuex? |
Use a computed property with a setter and getter when dealing with a Vuex store. // ...
computed: {
message: {
get () {
return this.$store.state.obj.message
},
set (value) {
this.$store.commit('updateMessage', value)
}
}
} |
yeah that's how I do it, |
@lopugit this is the Vuex way. If you use the equivalent form of v-model ( |
all g, how do they handle numbers? just a parseInt or more sophisticated? |
@lopugit very sophisticated. wish it were that easy to parseInt() only. Example: imagine parseInt() when user has typed "0." --> NaN. Or wanting to type (0.10004) --> typing "0.10" will turn this into "0.1" (you'll never be able to type full 0.10004). And the examples can go on and on and on and on. |
Ahh very interesting, can always copy the handler code :P |
Just thought you should be aware of what it does :) |
I know I'm very thankful, I've been wondering <3 Also v1 is sick ;) |
codepen link
quasar: 1.0.0-beta.17,
@quasar/app: 1.0.0-beta.18,
Browser: Chrome
OS: Windows 7
QInput with type="number" returns string instead of number. Type in any number or change the value of the QInput by clicking the up/down button will return a string value.
There was a fix #2605 for V0.x. But seems V1 hasn't got this issue fixed. Or maybe this is intended by design?
The text was updated successfully, but these errors were encountered: