From ff8d7ada73c8ab0c842cef2ab348392e2d55d5dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BD=A9=E8=BE=95Rowboat?= Date: Tue, 20 Jun 2017 14:10:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=83=E5=88=86=E7=AC=A6=E8=80=83=E8=99=91?= =?UTF-8?q?=E5=B0=8F=E6=95=B0=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/filters/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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, ','); + }); }