Commit 8f5d7a8a authored by 武广's avatar 武广

fix: 修复数字校验问题

parent 7e858c5b
import React from 'react';
import { Select, Form, InputNumber, Input, Button, Popover } from 'antd';
import commonStyle from '../common.less';
import { debounce } from '@/utils/utils';
export const WrapperContainer = props => (
<div className={commonStyle.container}>{props.children}</div>
......@@ -77,6 +78,7 @@ export const CreateFormInput = props => {
type,
batchProps,
disabeldRender,
onChange,
...options
} = props;
......@@ -87,7 +89,11 @@ export const CreateFormInput = props => {
{...options}
style={{ width: '100%' }}
placeholder={`请输入${title}`}
onBlur={e => onBlurEvent(e.target.value, dataIndex, rowIndex)}
// onBlur={e => onBlurEvent(e.target.value, dataIndex, rowIndex)}
onChange={e => {
onChange(e);
onBlurEvent(e.target.value, dataIndex, rowIndex);
}}
/>
);
}
......@@ -130,16 +136,22 @@ export const CreateFormInput = props => {
</>
);
}
// console.log('options :>> ', options);
return (
<InputNumber
{...roleProps}
{...options}
style={{ width: '100%' }}
placeholder={`请输入${title}`}
onBlur={e => {
onBlurEvent(e.target.value, dataIndex, rowIndex);
}}
// onBlur={e => {
// const v = e.target.value;
// console.log('v :>> ', v);
// onBlurEvent(+e.target.value || 0, dataIndex, rowIndex);
// }}
onChange={debounce(e => {
onChange(e);
onBlurEvent(e, dataIndex, rowIndex);
}, 300)}
/>
);
};
......@@ -64,6 +64,21 @@ export function isClass(o) {
return Object.prototype.toString.call(o).slice(8, -1);
}
export function debounce(fn, delay = 500) {
let timer = null;
return function fun(...args) {
if (timer) {
clearTimeout(timer);
}
timer = setTimeout(() => {
timer = null;
fn.apply(this, args);
}, delay);
};
}
// 深拷贝
export function deepClone(obj) {
let result;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment