hookehuyr

fix 修复数字控件保留小数位校验不准确问题影响提交

...@@ -146,7 +146,7 @@ const required = props.item.component_props.required; ...@@ -146,7 +146,7 @@ const required = props.item.component_props.required;
146 const min = props.item.component_props.min; 146 const min = props.item.component_props.min;
147 const max = props.item.component_props.max; 147 const max = props.item.component_props.max;
148 const max_count = props.item.component_props.max_fraction_count; // 保留小数个数 null=不限,0=没有小数,大于0=最多只能输入的小数个数 148 const max_count = props.item.component_props.max_fraction_count; // 保留小数个数 null=不限,0=没有小数,大于0=最多只能输入的小数个数
149 -const reg = new RegExp("^([0-9]+)(\\.(\\d){" + max_count +"," + max_count +"})$", "g"); 149 +const reg = new RegExp(`^\\d+(\\.\\d{${max_count}})?$`);
150 const validator = (val) => { 150 const validator = (val) => {
151 if (required && !val) { // 必填 151 if (required && !val) { // 必填
152 return false; 152 return false;
......