antD form表单 输入框默认值

需求:

进入页面请求接口,把这个值渲染到表单中的input上

 

const [indicators, setIndicators] = useState<any>({})
const [form] = Form.useForm();
 
useEffect(() => {
    form.setFieldsValue(indicators)
  }, [indicators])
 
<Form
              form={form}
            >
 
或者直接在formitem标签上写
initialValue = “xxx”
posted @ 2023-01-04 14:50  阿蒙不萌  阅读(139)  评论(0编辑  收藏  举报