fix: fixed numberFormatter bug

https://github.com/PanJiaChen/vue-element-admin/issues/2568
This commit is contained in:
花裤衩 2019-09-30 15:06:42 +08:00
parent 0e9ce78b8a
commit 8235011665
1 changed files with 1 additions and 1 deletions

View File

@ -45,7 +45,7 @@ export function numberFormatter(num, digits) {
] ]
for (let i = 0; i < si.length; i++) { for (let i = 0; i < si.length; i++) {
if (num >= si[i].value) { if (num >= si[i].value) {
return (num / si[i].value + 0.1).toFixed(digits).replace(/\.0+$|(\.[0-9]*[1-9])0+$/, '$1') + si[i].symbol return (num / si[i].value).toFixed(digits).replace(/\.0+$|(\.[0-9]*[1-9])0+$/, '$1') + si[i].symbol
} }
} }
return num.toString() return num.toString()