vue-money-format
A Vue component that formats currency.
This uses Intl.NumberFormat: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat
Description
This is a lightweight display component for localized currency display. It has no dependencies other than Vue. It supports both float and integer input, and can adjust for values stored as decimal-based subunits, such as cents, dirham, groszy, etc. Storing currency values in terms of the subunit allows you to store integers, rather than floating numbers, which ensures accuracy.
Many libraries, such as the Ruby Money and Money-Rails gems, expect monetary values to be stored as integers.
Features
- Supports suppression of the subunit display (you can display $100.65 or $101). When the subunit display is suppressed, the value will be rounded prior to display.
Installation
yarn add vue3-currency-formatter
or
npm install vue3-currency-formatter
Usage
<CurrencyFormater :currency="'INR'" ></CurrencyFormater>
You can also change currency
<script>
import CurrencyFormater from 'vue3-currency-formatter'
export default {
components: {
CurrencyFormater
},
}
</script>
Changelog
Changes for the current version:
- Fixed a typo in the usage instructions
- Update more supporting currency (Currently three currency supported USD,EUR and INR)