相关疑难解决方法(0)

在Reactjs中获取表单数据

我的render函数中有一个简单的表单,如下所示:

render : function() {
      return (
        <form>
          <input type="text" name="email" placeholder="Email" />
          <input type="password" name="password" placeholder="Password" />
          <button type="button" onClick={this.handleLogin}>Login</button>
        </form>
      );
    },
handleLogin: function() {
   //How to access email and password here ?
}
Run Code Online (Sandbox Code Playgroud)

我应该在handleLogin: function() { ... }访问EmailPassword字段中写什么?

html javascript frontend reactjs

166
推荐指数
17
解决办法
19万
查看次数

标签 统计

frontend ×1

html ×1

javascript ×1

reactjs ×1