Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when allowBlank is set last digits are missing #38

Closed
mazraara opened this issue Aug 19, 2021 · 3 comments
Closed

when allowBlank is set last digits are missing #38

mazraara opened this issue Aug 19, 2021 · 3 comments

Comments

@mazraara
Copy link

mazraara commented Aug 19, 2021

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
Copy link
Author

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

@jonathanpmartins
Copy link
Owner

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
Copy link
Owner

jonathanpmartins commented Aug 22, 2021

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:

  • If you setup 1 it will interpret it as 0.01.
  • If you setup 10 or 1.0 it will interpret it as 0.10.
  • If you setup 100 or 10.0 it will interpret it as 1.00.
  • If you setup 1.00 it will interpret it as 1.00.
  • If you setup 10.00 it will interpret it as 10.00.
  • If you setup 100.00 it will interpret it as 100.00.

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

Using v-model.number with precision 2:

  • If you setup 1 it will interpret it as 1.00.
  • If you setup 10 or 1.0 it will interpret it as 10.00.
  • If you setup 100 or 10.0 it will interpret it as 100.00.
  • If you setup 1.0 it will interpret it as 1.00.
  • If you setup 10.0 it will interpret it as 10.00.
  • If you setup 100.0 it will interpret it as 100.00.

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" />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants