语义-ui 输入中的未定义值
undefined value in semantic-ui input
我使用语义-ui-反应创建它的简单方法:
<Form onSubmit={this.handleSubmit.bind(this)}>
<Form.Field>
<Input placeholder="From ..." type="text" ref="from" />
<Label pointing>please enter valid email adress</Label>
</Form.Field>
<Divider />
现在我无法访问输入的值。这是我的代码:
from: this.refs.from.value
就这样了 undefined.how 可以解决这个问题吗?
我建议在文档的 controlled way, because most of SUIR components are functional, so they don't support refs. I've a codepen to show it in action. There is also example 中使用 Form
和相关组件。
我使用语义-ui-反应创建它的简单方法:
<Form onSubmit={this.handleSubmit.bind(this)}>
<Form.Field>
<Input placeholder="From ..." type="text" ref="from" />
<Label pointing>please enter valid email adress</Label>
</Form.Field>
<Divider />
现在我无法访问输入的值。这是我的代码:
from: this.refs.from.value
就这样了 undefined.how 可以解决这个问题吗?
我建议在文档的 controlled way, because most of SUIR components are functional, so they don't support refs. I've a codepen to show it in action. There is also example 中使用 Form
和相关组件。