wnumb是一款JS格式库,具有非常简单的接口。
1. 引入 wNumb.js 文件
var moneyFormat = wNumb({
mark: '.',
thousand: ',',
prefix: '$ ',
suffix: ' p.p.'
});
// Format a number:
moneyFormat.to( 301980.62 );
=> '$ 301,980.62 p.p.'
// Get a number back:
moneyFormat.from( '$ 301,980.62 p.p.' );
=> 301980.62
官网地址 :https://refreshless.com/wnumb/