常用的格式化数字插件

示例 格式化保留指定小数位数。 可用来格式化金额,手机号,银行卡等

formatDecimal(1.555, 2, 'round') // 1.56 formatDecimal(1.554, 2, 'round') // 1.55 formatDecimal(1.554, 2, 'ceil') // 1.56 formatDecimal(1.551, 2, 'ceil') // 1.56 formatDecimal(1.556, 2, 'floor') // 1.55 formatDecimal(1.553, 2, 'floor') // 1.55 formatNumber(18300000000, {type: ' ', splitLength: 4}) // 183 0000 0000 formatNumber(100000000.1, {type: ',', splitLength: 3}) // 100,000,000.1 formatNumber('6222600260001072444', {type: ' ', splitLength: 4, leftToRight: true}) // 6222 6002 6000 1072 444

版权声明:

1、该文章(资料)来源于互联网公开信息,我方只是对该内容做点评,所分享的下载地址为原作者公开地址。
2、网站不提供资料下载,如需下载请到原作者页面进行下载。