jonathanpmartins / v-money3

Vue3 currency input/directive mask
MIT License
103 stars 27 forks source link

when allowBlank is set last digits are missing #38

Closed mazraara closed 3 years ago

mazraara commented 3 years ago

when allowBlank is FALSE

€30.00 10.00%

image

allowBlank is TRUE

€0.30 0.10%

image

image

below is my overall config

{ "decimal": ".", "thousands": ",", "prefix": "€", "suffix": "", "min": 0, "max": 1000000, "precision": 2, "masked": false, "allowBlank": true, "disableNegative": true }

mazraara commented 3 years ago

i am using this as a directive, when i am using the component then this issue is no longer present

jonathanpmartins commented 3 years ago

I will take a look at it next week. I'm currently refactoring some of the original code and this issue is next on the list! Thanks for reporting!

jonathanpmartins commented 3 years ago

The code-base has suffered a big refactoring. Some behavior has become default with v-model. Please read the news on the docs page.

Directives are capable to work with Arbitrary Precision but in exchange it cannot work with floats by default anymore. Directives use v-model...

Using v-model with precision 2:

The components allow you to work with numbers with the v-model.number modifier.

Using v-model.number with precision 2:

I really encourage you to use the component instead of the directive, or change your format value when setup.

But...

If you really want to work with directives you can configure it manually.

This sould work on the new release of v-money3.

<input :model-modifiers="{ number: true }" v-model.lazy="amount" v-money3="config" />