-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Erindcl
committed
Aug 12, 2020
1 parent
b503266
commit 60f54bf
Showing
7 changed files
with
156 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
--- | ||
order: 0 | ||
title: | ||
zh-CN: 基本使用 | ||
en-US: Basic usage | ||
--- | ||
|
||
## zh-CN | ||
|
||
基本使用。 | ||
|
||
## en-US | ||
|
||
Basic usage example. | ||
|
||
```jsx | ||
import { Form, Icon, Input, Button, Checkbox, InputNumber, Radio, Switch } from 'antd'; | ||
const formItemLayout = { | ||
labelCol: { | ||
xs: { span: 24 }, | ||
sm: { span: 3 }, | ||
}, | ||
wrapperCol: { | ||
xs: { span: 24 }, | ||
sm: { span: 10 }, | ||
}, | ||
}; | ||
class NormalLoginForm extends React.Component { | ||
handleSubmit = e => { | ||
e.preventDefault(); | ||
this.props.form.validateFields((err, values) => { | ||
if (!err) { | ||
console.log('Received values of form: ', values); | ||
} | ||
}); | ||
}; | ||
|
||
render() { | ||
const { getFieldDecorator } = this.props.form; | ||
return ( | ||
<Form {...formItemLayout} onSubmit={this.handleSubmit}> | ||
<Form.Item label={'用户名'}> | ||
{getFieldDecorator('username', { | ||
rules: [{ required: true, message: 'It is required!' }], | ||
})( | ||
<Input placeholder="Username"/> | ||
)} | ||
</Form.Item> | ||
<Form.Item label={'密码'}> | ||
{getFieldDecorator('password', { | ||
rules: [{ required: true, message: 'It is required!' }], | ||
})( | ||
<Input type="password" placeholder="Password"/> | ||
)} | ||
</Form.Item> | ||
<Form.Item label={'次数限制'}> | ||
{getFieldDecorator('count', { | ||
rules: [{ required: false, message: 'It is required!' }], | ||
})( | ||
<InputNumber min={1} style={{ width: '100%' }} max={10} /> | ||
)} | ||
</Form.Item> | ||
<Form.Item label={'告警方式'}> | ||
{getFieldDecorator('way', { | ||
rules: [{ required: false, message: 'It is required!' }], | ||
})( | ||
<Checkbox.Group options={[{ label: '邮件', value: '1' }, { label: '短信', value: '2' }]} /> | ||
)} | ||
</Form.Item> | ||
<Form.Item label={'存储类型'}> | ||
{getFieldDecorator('type', { | ||
rules: [{ required: false, message: 'It is required!' }], | ||
})( | ||
<Radio.Group> | ||
<Radio value={1}>orc</Radio> | ||
<Radio value={2}>text</Radio> | ||
<Radio value={3}>md</Radio> | ||
</Radio.Group> | ||
)} | ||
</Form.Item> | ||
<Form.Item label={'开关'}> | ||
{getFieldDecorator('switch', { | ||
rules: [{ required: false, message: 'It is required!' }], | ||
})( | ||
<Switch /> | ||
)} | ||
</Form.Item> | ||
<Form.Item> | ||
<Button type="primary" htmlType="submit"> | ||
提交表单 | ||
</Button> | ||
</Form.Item> | ||
</Form> | ||
); | ||
} | ||
} | ||
|
||
const WrappedNormalLoginForm = Form.create({ name: 'normal_login' })(NormalLoginForm); | ||
|
||
ReactDOM.render(<WrappedNormalLoginForm />, mountNode); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
category: Components | ||
subtitle: 表单 | ||
type: 数据录入 | ||
title: Form | ||
cols: 1 | ||
--- | ||
|
||
具有数据收集、校验和提交功能的表单,包含复选框、单选框、输入框、下拉选择框等元素。 | ||
|
||
## 设计规则 | ||
|
||
纵向相邻表单之间的间隔为 20 px | ||
|
||
## API | ||
|
||
|类名 |说明 |使用示例 | | ||
|---------|---------|---------| | ||
|.dt-form-shadow-bg | 灰色背景,表单样式设置 | 灰色背景(仅默认主题下使用) | | ||
|.dt-form-light-bg | 浅色背景上,显示深色控件 | 浅色背景(仅暗黑主题下使用) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -178,6 +178,7 @@ a { | |
.demo-select-size { | ||
.ant-select { | ||
margin-bottom: 20px; | ||
margin-right: 20px; | ||
width: 200px; | ||
} | ||
} | ||
|