This commit is contained in:
2022-12-12 10:04:13 +08:00
parent b12826594e
commit 23f2e2ff67
4 changed files with 20 additions and 7 deletions

View File

@@ -67,7 +67,7 @@ const formatMoney = function (s: string) {
var noNegative = true;
s = parseFloat((s + "").replace(/[^\d\.-]/g, "")) + "";
if (parseFloat(s) < 0) {
s = Math.abs(s).toFixed(2) + "";
s = Math.abs(s) + "";
noNegative = false;
}
@@ -81,7 +81,12 @@ const formatMoney = function (s: string) {
t += l[i] + ""; //加上空格
}
}
return (noNegative ? "" : "-") + t.split("").reverse().join("") + "." + r;
if(r){
return (noNegative ? "" : "-") + t.split("").reverse().join("") + "." + r;
}else{
return (noNegative ? "" : "-") + t.split("").reverse().join("")
}
}
watch(