vuejs-tips / vue-the-mask

Tiny (<2k gzipped) and dependency free mask input for Vue.js
https://vuejs-tips.github.io/vue-the-mask/
1.72k stars 212 forks source link

How to set a minimum value? #121

Closed BrianXJ6 closed 4 years ago

BrianXJ6 commented 4 years ago

I'm using vue-the-mask, it meets my requirements very well, but I realized that using the v-mask directive on an input disables HTML5 "minlength" validation

Is there any way to set this in the directive or is it a bug?

RonaldJerez commented 4 years ago

@BrianXJ6 I haven't tried with the HTML5 minlength but I did have an issue with vee-validate min. I realized that the reason is because we're expecting that min is to validate the characters entered without the masking. But the masked characters count toward the min as well. What worked for me was to use the component instead of the directive because the component can emit the input event with the unmasked input while still displaying the masked input.

BrianXJ6 commented 4 years ago

Thanks for the help