|
| 1 | +# Vue Intl.NumberFormat |
| 2 | + |
| 3 | +[](https://npmjs.com/package/vue-intl-numberformat) [](https://npmjs.com/package/vue-intl-numberformat) [](https://travis-ci.org/vinayakkulkarni/vue-intl-numberformat) |
| 4 | + |
| 5 | +* Tiny reusable Vue wrapper for Intl NumberFormat |
| 6 | + |
| 7 | +- This is [on GitHub](https://github.com/vinayakkulkarni/vue-intl-numberformat) so let me know if I've b0rked it somewhere, give me a star :star: if you like it :beers: |
| 8 | + |
| 9 | +## Install |
| 10 | + |
| 11 | +```bash |
| 12 | +yarn add vue-intl-numberformat |
| 13 | +``` |
| 14 | + |
| 15 | +CDN: [UNPKG](https://unpkg.com/vue-intl-numberformat/dist/) | [jsDelivr](https://cdn.jsdelivr.net/npm/vue-intl-numberformat/dist/) |
| 16 | + |
| 17 | +## Usage |
| 18 | + |
| 19 | +```vue |
| 20 | +<template> |
| 21 | + <vue-intl-numberformat locale="en-IN" formatStyle="currency" currency="INR" :number="303041.201"></vue-intl-numberformat> |
| 22 | +</template> |
| 23 | +
|
| 24 | +<script> |
| 25 | +import VueIntlNumberformat from 'vue-intl-numberformat'; |
| 26 | +
|
| 27 | +export default { |
| 28 | + components: { |
| 29 | + VueIntlNumberformat, |
| 30 | + }, |
| 31 | +}; |
| 32 | +</script> |
| 33 | +``` |
| 34 | + |
| 35 | +## API |
| 36 | + |
| 37 | +### Props |
| 38 | + |
| 39 | +| Name | Type | Required? | Description | |
| 40 | +| ------------- | ------ | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
| 41 | +| `number` | Number | Yes | The digit that you want to format. | |
| 42 | +| `locale` | String | No | A string with a BCP 47 language tag. [More Here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation) | |
| 43 | +| `formatStyle` | String | No | The formatting style to use. Possible values are "decimal" for plain number formatting, "currency" for currency formatting, and "percent" for percent formatting; the default is "`decimal`". | |
| 44 | +| `currency` | String | No | The currency to use in currency formatting. Possible values are the ISO 4217 currency codes, such as "USD" for the US dollar etc. [More Here](http://www.currency-iso.org/en/home/tables/table-a1.html) | |
| 45 | +| `maxDigits` | Number | No | The maximum number of significant digits to use. Possible values are from 1 to 21. | |
| 46 | + |
| 47 | +## Contributing |
| 48 | + |
| 49 | +1. Fork it! |
| 50 | +2. Create your feature branch: `git checkout -b my-new-feature` |
| 51 | +3. Commit your changes: `git commit -am 'Add some feature'` |
| 52 | +4. Push to the branch: `git push origin my-new-feature` |
| 53 | +5. Submit a pull request :D |
| 54 | + |
| 55 | +## Author |
| 56 | + |
| 57 | +**vue-intl-numberformat** © [Vinayak](https://github.com/vinayakkulkarni), Released under the [MIT](./LICENSE) License.<br> |
| 58 | +Authored and maintained by Vinayak Kulkarni with help from contributors ([list](https://github.com/vinayakkulkarni/vue-intl-numberformat/contributors)). |
| 59 | + |
| 60 | +> [vinayak.site](https://vinayak.site) · GitHub [@vinayakkulkarni](https://github.com/vinayakkulkarni) · Twitter [@\_vinayak_k](https://twitter.com/_vinayak_k) |
0 commit comments