diff --git a/src/filters/index.js b/src/filters/index.js index 36cb3e7c..4943cde8 100644 --- a/src/filters/index.js +++ b/src/filters/index.js @@ -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, ','); + }); }