Commit b0f6b112 by zhaochengxiang

类型输入框限制只允许输入数字

parent dd7f3a88
......@@ -85,8 +85,9 @@ export const DatatypeInput = ({ value = {}, datatypes, onChange }) => {
const onParameterValuesChange = (e, index) => {
const parameterValue = e.target.value;
const reg = /^-?\d*(\.\d*)?$/;
if ((!isNaN(parameterValue) && reg.test(parameterValue)) || parameterValue === '') {
//只允许输入数字
const reg = /^\d+$/;
if (reg.test(parameterValue) || parameterValue === '') {
const newParameterValues = [...(value.parameterValues||[])];
//默认为0
......@@ -125,7 +126,6 @@ export const DatatypeInput = ({ value = {}, datatypes, onChange }) => {
</div>
{
(value.parameterCnNames||[]).map((parameterCnName, index) => {
//使用InputNumber:当value改变时 InputNumber显示值没改变 但实际值有改变 是ant design的bug 这里使用只能输入数字的Input
return (
<div key={index} className='ml-2' style={{ flex: 1 }}>
<Input
......
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