RonaldJerez / vue-input-facade

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

incorrectly triggers validation #21

Closed pancake-boy closed 4 years ago

pancake-boy commented 4 years ago

Describe the bug A clear and concise description of what the bug is. I'm migration from vue-the-mask I'm using a vuetify v-text-field

with vue-the-mask, when the page loads, no validation is triggered. with vue-input-facade, when the page loads, it seems to set the field to empty string and triggers validation.

it seems the text box is initially null, but the directive sets it to '' empty string data, it triggers an input change

is there a way to force it to remain null?

 <v-text-field
      v-model="data"
      v-facade="mask"
      :rules="rules.required"
    >
RonaldJerez commented 4 years ago

There is no current way to force it to remain null. Since the masked value always goes to an input field it needs to be a string.

Can you just set the initial value to “”? That is still considered falsy if you need to check that a value was set.

pancake-boy commented 4 years ago

my model properties defaults to null. I would have to do some ugly work around to have another variable set to '' and then synchronise that with my model property.

RonaldJerez commented 4 years ago

I think i got a solution. Just need to test it out and make sure it doesn't break anything else.

ktiedt commented 4 years ago

my model properties defaults to null. I would have to do some ugly work around to have another variable set to '' and then synchronise that with my model property.

Is '' a valid value for your models? Otherwise it seems like a strange thing to avoid...

RonaldJerez commented 4 years ago

:tada: This issue has been resolved in version 1.3.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket: