语义ui输入中的未定义值

时间:2017-08-29 13:47:43

标签: javascript reactjs semantic-ui semantic-ui-react

我很简单,我使用semantic-ui-react来创建它:

  <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可以解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

我建议在controlled way中使用Form及相关组件,因为大多数SUIR组件都是有效的,所以他们don't support参考。我有一个codepen来展示它的实际效果。文档中还有example