Comments (6)
I thought about this, too. Should use Math.round()
?
The line needed to be changed is this one:
https://github.com/vuejs-tips/v-money/blob/master/src/utils.js#L22
and this one:
https://github.com/vuejs-tips/v-money/blob/master/src/component.vue#L70
And the input format, too.
I'm not happy with the name minorUnits, any other suggestion?
from v-money.
Thanks @neves - I will try to put a PR together for this in the next few days.
Some other suggestions for the options name if you don't like minorUnits:
- multiplier
- precisionMultiplier
- cents
- integer
I'm sure there are plenty of other possibilities!
from v-money.
Since the number 12,34 would be converted to 1234 which is que amount of cents in the value, I think cents would be more appropriated.
from v-money.
Forget about Math.round, there's no need to.
I think just converting R$ 12,34 to 1234 (using onlyNumbers https://github.com/vuejs-tips/v-money/blob/master/src/utils.js#L25) and converting back to integer with parseInt is enough.
from v-money.
Any progress been made on this?
from v-money.
For those interested, I just wanted to share I ended up using the vue-currency-input package for this purpose, which includes the option value-as-integer
(see config reference).
For the sake of tidiness I will close this issue. Apologies I was not able to contribute to this great package.
from v-money.
Related Issues (20)
- campo de preço sem a opção do usuário colocar os centavos HOT 1
- I'm new here: How to install? HOT 2
- Not working with big Integer HOT 2
- How to associate with a label? HOT 1
- v-money deprecated? HOT 4
- Having numbers in suffix property it gives me an infinite loop HOT 2
- toFixed(x) for non-masked values HOT 1
- Update values of child component with v-money HOT 2
- Support for Vue3 (with v-money3) HOT 1
- Error on null value and do not return Empty String HOT 2
- How to override global options
- how to format value only for display?
- Is it possible to change the direction of the inputs from rtl to ltr?
- Decimal and thousands separator through props
- Zeros being deleted unnecessarily HOT 1
- How to apply v-money to dynamically generated inputs HOT 1
- Display decimal depois da Virgula HOT 2
- How to disabled negative number? HOT 2
- always keep the cents empty HOT 1
- support amounts with no decimal? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from v-money.