1.0.0 • Published 5 years ago

yzf-number-format v1.0.0

Weekly downloads
1
License
ISC
Repository
-
Last release
5 years ago

完整压缩版-欢迎使用(3.26 kB)

** 版权属于yzflhez@126.com

NFormat(value, format)数字Filter

// const aa = NFormat(122121.221, '0'); // 取整,不要小数
// NFormat('122121.221', '0,0') 整数使用3位英文逗号分隔 => 122,121
// NFormat('122121.221', '0,0.00') => 122,121.22
// NFormat('122121.221', '0.00z') => "一十二万二千一百二十一点二二"
// NFormat('122121.221', '0.00k') => 122.12千
// NFormat('122121.221', '0.00w') => 12.21万
// NFormat('122121.221', '0.00m') => 0.12百万
// NFormat('122121.221', '0.00b') => 0.00十亿
// NFormat('+122121.221', '0.00%') => "+12212122.10%"
// NFormat('122121.221', '0,0.00%') => "12,212,122.10%"

模块引入

~ tnpm install yzf-number-format --save
~ import { NFormat } from 'yzf-number-format';