Form

  • useWatch: 和 自定义监听的延迟问题

    1. const Demo = () => {
    2. const [form] = Form.useForm();
    3. const value = Form.useWatch('name', form);
    4. return (
    5. <Form form={form}>
    6. <Form.Item name="name" label="name">
    7. <Input />
    8. </Form.Item>
    9. <Form.Item noStyle dependencies={['name']}>
    10. {() => {
    11. // 这里的要比 useWatch 早
    12. return (
    13. <Form.Item name="test" label="test">
    14. <Input />
    15. </Form.Item>
    16. );
    17. }}
    18. </Form.Item>
    19. </Form>
    20. );
    21. }

    image.png