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

Cannot set null value in v-model fields with mask array v-mask="['###.###.###-##', '##.###.### / ####-##']" #67

Closed eder-ferraz-caciano closed 2 years ago

eder-ferraz-caciano commented 2 years ago

Describe the bug

When using a mask array in the v-mask directive, it is not possible to set a null value in the v-model. This makes it impossible to reset the form data. Example of using the mask: <input v-model="CpfCnpj" type="text" v-mask="['###.###.###-##', '##.###.###/####-##']" /> <button @click="CpfCnpj = null"> Clear </button>

To Reproduce Steps to reproduce the behavior:

  1. Use a mask array in the mask directive as in the example: v-mask="['###.###.###-##', '##.###.###/## ##-##']"
  2. set value in v-model ex: <button @click="CpfCnpj = 00133266545"> Set Value </button> image
  3. Set a null value in the v-model of the component where the mask array is used. <button @click="CpfCnpj = null"> Clear </button>
  4. When setting null value in v-model, it is not applied.

Expected behavior It must be possible to set a null value in the v-model that has the mask array

Desktop (please complete the following information):

Additional context Only the component that uses a mascara array doesn't allow to set null value in v-model. So correctly a form is impossible.

RonaldJerez commented 2 years ago

I was unable to reproduce this on both chrome or safari, setting to null worked fine in the demo page.

dynamic-masks

MatthewAry commented 1 year ago

I am having this problem. Here is my attempt to reproduce. https://codepen.io/MatthewAry/pen/MWXOzJV

simonmaass commented 1 year ago

i am having the same problem with vuetify