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

View File

@ -142,7 +142,7 @@ const _sfc_main = defineComponent({
if (props.qfw) { if (props.qfw) {
var formatMoney = function(s) { var formatMoney = function(s) {
var noNegative = true; var noNegative = true;
s = parseFloat((s + "").replace(/[^\d\.-]/g, "")).toFixed(2) + ""; s = parseFloat((s + "").replace(/[^\d\.-]/g, "")) + "";
if (parseFloat(s) < 0) { if (parseFloat(s) < 0) {
s = Math.abs(s).toFixed(2) + ""; s = Math.abs(s).toFixed(2) + "";
noNegative = false; noNegative = false;
@ -160,8 +160,8 @@ const _sfc_main = defineComponent({
}; };
try { try {
let reg = /\d{1,3}(?=(\d{3})+$)/g; let reg = /\d{1,3}(?=(\d{3})+$)/g;
console.log("\u6DFB\u52A0\uFF0C", formatMoney(props.modelValue)); console.log("\u6DFB\u52A0\uFF0C", formatMoney(props.modelValue.toString()));
currentValue.value = formatMoney(props.modelValue); currentValue.value = formatMoney(props.modelValue.toString());
} catch { } catch {
currentValue.value = "\u8F93\u5165\u9519\u8BEF"; currentValue.value = "\u8F93\u5165\u9519\u8BEF";
} }

View File

@ -11238,7 +11238,7 @@ const _sfc_main$1v = defineComponent({
if (props.qfw) { if (props.qfw) {
var formatMoney = function(s) { var formatMoney = function(s) {
var noNegative = true; var noNegative = true;
s = parseFloat((s + "").replace(/[^\d\.-]/g, "")).toFixed(2) + ""; s = parseFloat((s + "").replace(/[^\d\.-]/g, "")) + "";
if (parseFloat(s) < 0) { if (parseFloat(s) < 0) {
s = Math.abs(s).toFixed(2) + ""; s = Math.abs(s).toFixed(2) + "";
noNegative = false; noNegative = false;
@ -11256,8 +11256,8 @@ const _sfc_main$1v = defineComponent({
}; };
try { try {
let reg = /\d{1,3}(?=(\d{3})+$)/g; let reg = /\d{1,3}(?=(\d{3})+$)/g;
console.log("\u6DFB\u52A0\uFF0C", formatMoney(props.modelValue)); console.log("\u6DFB\u52A0\uFF0C", formatMoney(props.modelValue.toString()));
currentValue.value = formatMoney(props.modelValue); currentValue.value = formatMoney(props.modelValue.toString());
} catch { } catch {
currentValue.value = "\u8F93\u5165\u9519\u8BEF"; currentValue.value = "\u8F93\u5165\u9519\u8BEF";
} }

View File

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

File diff suppressed because one or more lines are too long