import { useEffect, useState } from 'react'; import { Space, Input, Select } from 'antd'; import styles from './index.less'; interface Props { value?: API.ParameterValue; onChange?: (value?: API.ParameterValue) => void; onBlur?: () => void; } const optionConfig = [ { label: '自动分配', value: true }, { label: '自定义', value: false }, ]; export default function Parameter({ value: itemValue, onChange, onBlur, }: Props) { const [parameterValue, setParameterValue] = useState(itemValue); useEffect(() => { if (onChange) { if ( itemValue?.adaptive !== parameterValue?.adaptive || itemValue?.value !== parameterValue?.value ) { onChange(parameterValue); } } }, [parameterValue]); return ( setParameterValue({ ...parameterValue, value: e.target.value }) } /> ); }