RonaldJerez / vue-input-facade

A lightweight and dependency free input masking library created specific for Vue
https://ronaldjerez.github.io/vue-input-facade/latest/
182 stars 27 forks source link

multimask #18

Closed murka closed 4 years ago

murka commented 4 years ago

Hey, how to change mask for: 1) when I write "+1 (732) 123-4567", @vue-input-facade rewrite to "+17321234567". 2) when I write "(732) 123-4567", it rewrites to "+17321234567" 3) when I write "1 (732) 123-4567" it rewrites to "+17321234567"

I tried use @vue-the-mask, but I didn’t succeed.

RonaldJerez commented 4 years ago

When you say “rewrite” I’m going to assume you mean return value and not what’s shown on the screen.

You can use this mask “+1 ### ### - ####“ and set prefill to true. But you won’t get the +1 as part of your return value because that’s static. So you can either add that yourself where ever you need it, or use a formatting function to add it.

<input-facade mask="+1 (###) ### - ####" v-model="value" prefill />

See the demo page for how to use the formatting functions.