A Vue 3 headless component to formatting numbers using Intl.numberFormat.
npm install v3-numA Vue 3 headless component to formatting numbers using Intl.numberFormat.
> Warning: the v3-num tend to use Intl.numberFormat API internally. It is made for modern browsers, but if you want to keep things also working for older ones, make sure to polyfill the Intl API
``bash`
yarn add v3-num
`js
import { createApp } from "vue";
import VNum from "v3-num";
createApp.use(VNum);
`
`vue
{{ number }}
`
Basic decimal formatter.
`vue
{{ number }}
`
Output:
``
1,000
---
Make the value rounded to the nearest integer.
`vue
{{ number }}
`
Output:
``
1,001
---
Percentage formatting
`vue
:value="17.5678 / 100"
number-style="percent"
maximum-fraction-digits="2"
sign-display="always"
>
{{ number }}
`
Output:
```
+17.57%
For more example checkout the Intel.numberFormat documentations.