代码之家  ›  专栏  ›  技术社区  ›  Ansjovis86

如何在React with the reactstrap库中设置过账表单?

  •  0
  • Ansjovis86  · 技术社区  · 9 年前

    我是React和reactstrap的新手,我想知道如何设置一个表单,在提交时使用表单标签发布到帖子路由。我在文档中找不到这样做的例子。所以我在寻找一个与之相当的例子:

    <form action='/signup/insert' method = 'POST'>
        <div class="form-group">
            <input id ='signup' type='text' name='uid' placeholder='Username'><br>
            <input id ='signup' type='password' name='pwd' placeholder='Password'><br>
            <input id ='signup' type='text' name='email' placeholder='E-mail address'><br>
            <button id = 'switch' type='submit'>Sign Up</button>
         </div>
     </form>
    

    我想要这样的东西:

    <Form>
        <FormGroup>
            <Label for="exampleEmail">Email</Label>
            <Input
                type="email"
                name="email"
                id="exampleEmail"
                placeholder="noreply@noreply.com"
            />
        </FormGroup>
        <FormGroup>
            <Label for="examplePassword">Password</Label>
            <Input
                type="password"
                name="password"
                id="examplePassword"
                placeholder="password"
            />
         </FormGroup>
         <Button>Sign Up</Button>
    </Form>
    

    我必须在按钮标签中添加这个吗?怎么做?顺便说一句,我的路线已经设置好了,所以我只需要从这里发布。

    1 回复  |  直到 9 年前
        1
  •  1
  •   Marek Takac    9 年前

    与没有Reactstrap的示例完全相同。 Form 组件将您提供的任何属性传递给 <form> 在页面上呈现的标记 <Form action='/signup/insert' method='POST'>