Is it possible to use q-input with mask for complex structured input?
-
I’d like to use the q-input, if possible for taking input such as point 3d or vector. This would be represented as a 3 float array or as a 6 or 7 float array. For a point 3d, the mask may look something like:
[#.#, #.#, #.#]
For each coordinate, I would like to be able to accept any number of digits before and after the period. I would also like to have the
[],
characters fixed in the mask. In other words, I would like the input to have them prepopulated, with the cursor between the[
and the first,
when first entering the control. I would also like the cursor to jump to the next float number when the user hits the,
key.Following the credit card input example in the docs, I got the input to display and skip the
[],
characters, but I cannot make it accept any number of digits for a single#
character in the mask. Is there any other way to accomplish this? -
@tdumitr list of masks are seen here https://quasar.dev/vue-components/input#Mask , other combo, either you use a third party https://quasar.dev/vue-components/input#Using-third-party-mask-processors , or roll out your own.
you can assign it like here https://codepen.io/metalsadman/pen/YzyawzO?editable=true&editors=101%3Dhttps%3A%2F%2Fquasar.dev%2Fvue-components%2Finput , but you will have to do your own logic based on your explanation. use a ref and target the inner input to get the native functions to control the cursor. Or check the helper script found here https://github.com/quasarframework/quasar/blob/dev/ui/src/mixins/mask.js#L2.
-
@metalsadman: Thank you. I will give it a try.