-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
QInput v-model.trim is too eager #1691
Comments
Did you actually follow my notes though? Type "Step 1" then delete the 1 and see the difference. |
Also see this. I did start with Vue. I've tried it in many different browsers (Chrome, FF, Safari, IE) and see the same in all. Note in the pen linked from that Vue forum post, the model is trimmed on input, but the actual input box retains the trailing space, so that subsequent typing doesn't lose the space. |
While this works for native inputs, it cannot work with v-model on components. This is due to how Vue works. Explanation:
Use lazy loading (check docs, it explains it very well) OR an equivalent |
That's a shame. For completeness, this is the Vue forum post I originally sent this too (my previous link was bad), where it was pointed out the native component works as expected. The workaround I've been using:
isn't too bad I guess. |
Software version
Quasar: 0.15.
OS:
Node:
NPM:
Browsers:
iOS:
Android:
Any other software related to your bug:
JsFiddle (for Quasar v0.15+ only)
https://codepen.io/anon/pen/WMBvZR
What did you get as the error?
When editing a text input with
v-model.trim="data"
, it is very awkward to delete words that are separated by spaces, as thetrim()
happens on every change and therefore 'consumes' the space that would separate words.E,g. type "Step 1" into the text input and then delete the '1' and replace it with a '2". For a plain
input
element, this ends with "Step 2", but forq-input
it ends with "Step2" unless great care is taken.What were you expecting?
q-input
would behave the same asinput
, and not erase spaces during editing.The text was updated successfully, but these errors were encountered: