import React from "react"; import { Form, Input } from 'antd'; class TestForm extends React.Component { componentDidMount(){ const { setFieldsValue } = this.props.form; // 这里就能实现指定表单设置value setTimeout(()=>{ setFieldsValue({"username": "Tom"}) },5000) } render() { const { getFieldDecorator } = this.props.form; return ( <Form > <Form.Item> {getFieldDecorator('username', {})(<Input />)} </Form.Item> </Form> ); } } export default Form.create()(TestForm)
参考:https://blog.csdn.net/qq_36990322/article/details/97641604