This commit is contained in:
2022-12-12 09:36:12 +08:00
parent 80c457a21b
commit 937a34f05e
4 changed files with 11 additions and 11 deletions

View File

@@ -114,9 +114,9 @@ const onBlur = (event: Event) => {
onNumberBlur(event);
}
if(props.qfw){
var formatMoney=function(s){
var formatMoney=function(s: string){
var noNegative = true;
s = parseFloat((s + "").replace(/[^\d\.-]/g, "")).toFixed(2) + "";
s = parseFloat((s + "").replace(/[^\d\.-]/g, "")) + "";
if(parseFloat(s) < 0){
s = Math.abs(s).toFixed(2) + "";
noNegative = false;
@@ -137,8 +137,8 @@ const onBlur = (event: Event) => {
try{
let reg = /\d{1,3}(?=(\d{3})+$)/g;
// new String(props.modelValue).replace(reg, '$&,');
console.log("添加,", formatMoney(props.modelValue))
currentValue.value = formatMoney(props.modelValue);
console.log("添加,", formatMoney(props.modelValue.toString()))
currentValue.value = formatMoney(props.modelValue.toString());
}catch{
currentValue.value = "输入错误"
}