亲爱的社区,
Ant Design 是一个很棒的用户界面系统,过去几个月我们一直在广泛使用它。
感谢您设计和开源这个库。
——
提交表单后,我需要清除 AutoComplete 组件。
我试图做到以下几点:
...
<AutoComplete ref='toField' />
...
// In a callback
this.refs.toField.value = null;
但它不起作用。 如何才能做到这一点 ?
谢谢。
不要使用 ref 来控制组件状态,使用 React 状态。
http://facebook.github.io/react/docs/forms.html#controlled -components
@afc163谢谢。
此线程已被自动锁定,因为它最近没有活动。 请为相关错误打开一个新问题并链接到此线程中的相关评论。
最有用的评论
不要使用 ref 来控制组件状态,使用 React 状态。
http://facebook.github.io/react/docs/forms.html#controlled -components
http://codepen.io/afc163/pen/MbQXRV?editors=001