forked from AkkomaGang/admin-fe
千分符考虑小数点
This commit is contained in:
parent
bf480ca6b4
commit
ff8d7ada73
1 changed files with 4 additions and 1 deletions
|
@ -104,5 +104,8 @@ export function html2Text(val) {
|
|||
|
||||
|
||||
export function toThousandslsFilter(num) {
|
||||
return (+num || 0).toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,');
|
||||
return (+num || 0).toString()
|
||||
.replace(/^\-?\d+/g, function(m){
|
||||
return m.replace(/(?=(?!\b)(\d{3})+$)/g, ',');
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue