Ant-design-pro: form 的 initialValues 属性无效

Created on 11 May 2020  ·  7Comments  ·  Source: ant-design/ant-design-pro

form 的 initialValues 属性无效,
form里面加了{initialValues.属性},可以显示。

太难了!

image
image

🕵🏻‍♀️ question

All 7 comments

image
我是这么用的,没有问题.

Drawer 关闭的时候销毁Form实例,或者手动setFieldsValue

image

image

现在显示是可以显示了,console.出现这个鬼

updateForm.setFieldsVlaue需要放在useEffect里面

useEffect(()=>{
  updateForm.setFieldsValue(initValues)
}, [myinitialValues])

你放在外面的话,第一次调用的时候组件还没有渲染,Form还没有实例化

image
image

终于,不报错了!!!感谢,感谢!
昨天这个鬼,百度到半夜2点 。不如你这一句话。
我太难了!

多看看文档,熟悉一下组件就好啦,靠百度还不如靠自己 😄

有时候,也要跟对 对象 😆,看师傅 @huntdream @

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kaoding picture kaoding  ·  3Comments

suifan picture suifan  ·  3Comments

zhuanglong picture zhuanglong  ·  3Comments

Yoping picture Yoping  ·  3Comments

yjz1004 picture yjz1004  ·  3Comments