<script> import { Form, Icon, Input, Button, Checkbox } from 'antd' const FormItem = Form.Item const NormalLoginForm = { methods: { handleSubmit (e) { e.preventDefault() this.form.validateFields((err, values) => { if (!err) { console.log('Received values of form: ', values) } }) }, }, render () { const { getFieldDecorator } = this.form return ( <Form id='components-form-demo-normal-login' onSubmit={this.handleSubmit} class='login-form'> <FormItem> {getFieldDecorator('userName', { rules: [{ required: true, message: 'Please input your username!' }], })( <Input prefix={<Icon type='user' style={{ color: 'rgba(0,0,0,.25)' }} />} placeholder='Username' /> )} </FormItem> <FormItem> {getFieldDecorator('password', { rules: [{ required: true, message: 'Please input your Password!' }], })( <Input prefix={<Icon type='lock' style={{ color: 'rgba(0,0,0,.25)' }} />} type='password' placeholder='Password' /> )} </FormItem> <FormItem> {getFieldDecorator('remember', { valuePropName: 'checked', initialValue: true, })( <Checkbox>Remember me</Checkbox> )} <a class='login-form-forgot' href=''>Forgot password</a> <Button type='primary' htmlType='submit' class='login-form-button'> Log in </Button> Or <a href=''>register now!</a> </FormItem> </Form> ) }, } export default Form.create()(NormalLoginForm) </script> <style> #components-form-demo-normal-login .login-form { max-width: 300px; } #components-form-demo-normal-login .login-form-forgot { float: right; } #components-form-demo-normal-login .login-form-button { width: 100%; } </style>