All Projects → dmackca → vue-filter-number-format

dmackca / vue-filter-number-format

Licence: other
Vue.js filter for formatting numbers

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to vue-filter-number-format

vue-filter-pluralize
Simple pluralize filter for Vue.js
Stars: ✭ 13 (-23.53%)
Mutual labels:  vue-filter
vue-string-filter
✂️ Vue 2.x lightweight string manipulation filter
Stars: ✭ 38 (+123.53%)
Mutual labels:  vue-filter
FormatEditText
格式化输入框,可用来格式化数字、金额、号码等; FormatEditText can be used as a formatted text input box
Stars: ✭ 121 (+611.76%)
Mutual labels:  number-format
ChangeNumbersJs
Tiny Library for change number from a language in other language.
Stars: ✭ 14 (-17.65%)
Mutual labels:  number-format
vue-filter-date-format
Simple date formatting filter for Vue.js
Stars: ✭ 111 (+552.94%)
Mutual labels:  vue-filter
number-format
Wrapper above number_format and unit convertor.
Stars: ✭ 18 (+5.88%)
Mutual labels:  number-format
formatters
A javascript library for formatting and manipulating.
Stars: ✭ 14 (-17.65%)
Mutual labels:  number-format

vue-filter-number-format

Vue.js filter for formatting numbers

This is a simple wrapper for Numeral.js.

Numeral.js 2 required

This package requires you to install Numeral.js as a peer dependency (numeral@^2). This way, you can use a different version of Numeral, or even a drop-in replacement with the same API. Use version 1 of this package if you want it to install its own Numeral.js dependency as part of the bundle.

Suggested usage

Pass in Numeral to create the formatter function, and register globally as a Vue filter in your main.js-ish file:

import numeral from 'numeral';
import numFormat from 'vue-filter-number-format';

Vue.filter('numFormat', numFormat(numeral));

// new Vue ...

Use anywhere in your .vue files:

// default format is '0,0'
{{ 69696969 | numFormat }} -> "69,696,969"

// use a custom format string
{{ 420 | numFormat('0.000') }} -> "420.000"
{{ 666 | numFormat('0,0o') }} -> "666th"

See the Numeral.js docs for other formatting options.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].