Closed drdevelop closed 10 months ago
复现代码如下: import React from 'react'; import { Form, Button } from 'antd'; import SchemaForm from 'antd-pro-schema-form';
export default () => { const [form] = Form.useForm(); const schema = [{ fieldName: 'title', label: '标题', type: 'input', placeholder: '请输入', rules: [{ required: true, message: '请输入标题' }], elementSpecProps: { onChange(e) { console.log('标题改变', e.target.value); } } }]
const onSubmit = () => { // 获取不到数据 alert(JSON.stringify(form.getFieldsValue())); }; return ( <> <SchemaForm form={form} schema={schema} /> <Button type="primary" onClick={onSubmit}> 提交 </Button> </> )
}
fixed
复现代码如下: import React from 'react'; import { Form, Button } from 'antd'; import SchemaForm from 'antd-pro-schema-form';
export default () => { const [form] = Form.useForm(); const schema = [{ fieldName: 'title', label: '标题', type: 'input', placeholder: '请输入', rules: [{ required: true, message: '请输入标题' }], elementSpecProps: { onChange(e) { console.log('标题改变', e.target.value); } } }]
}