getFieldValue
获取表单指定 name
值,setFieldsValue
为表单指定 name
设定值
import type { ProFormInstance } from '@ant-design/pro-components';
const CreateDictForm: React.FC<CreateFormProps> = (props) => {
// 创建一个ref
const ref = useRef<ProFormInstance>();
const renderContent = () => {
return (
<ProForm formRef={ref}>
<ProFormSelect
name="configName"
fieldProps={{
onChange: (val: any) => {
// name 为 form name
const name = ref.current?.getFieldValue({ name: 'name' })
// configName 为 form configName
ref.current?.setFieldsValue({ configName: undefined });
},
}}
/>
</ProForm>
);
};
标签:const,name,getFieldValue,setFieldsValue,pro,ref,configName
From: https://www.cnblogs.com/niuben/p/16582912.html