How is <v-text-field type="number" />
supposed to work?
#21216
Unanswered
frederikheld
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to use
v-text-field
withtype="number"
in order to get a proper number keyboard on mobile devices.However, it seems to be impossible to work with this configuration.
If I type in numbers only, everything is fine, the v-model gets updated to the same value the input shows.
But if I type in non-number characters, the v-model becomes "" but the input shows whatever was typed in (including the non-number characters). So there seems to be some validation but it is not reflected in the rendering.
How can I fix this?
My preferred solution would be that the number input just does not accept any other character than
[0-9]
.I tried all kinds of tricks with
@update:model-value
but nothing really works. It would work with a default input, but then I get the full text keyboard which I do not want.Any help appreciated!
Beta Was this translation helpful? Give feedback.
All reactions