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

Zero overwritten when Vue .number modifier used on v-model directive #61

Closed err108 closed 2 years ago

err108 commented 2 years ago

When using the v-facade directive on a component that uses the .number (type cast value as a number) modifier on the v-model directive, the value is being set to an empty string if a 0 is entered.

<v-text-field v-model.number="myNumberThatCanBeZero" v-facade="'##'" />

Looks like a falsy check is being done which is setting the value to the empty string.

https://github.com/RonaldJerez/vue-input-facade/blob/35a95ee21058b16a65533abf99d0a19e820203b6/src/core.js#L156

Would it be be possible update to look for zero there as well? Maybe something like...

currentValue = currentValue || currentValue === 0 ? currentValue : ''

err108 commented 2 years ago

We were using v.1.4.1. This is fixed as of v.2.0.0-beta.3. Closing out the issue.

RonaldJerez commented 2 years ago

Note that 2.0 is already released so you shouldn’t have to use the beta anymore.