提交 e66a43a4 编写于 作者: B Benjy Cui

docs: update Form's demo

上级 b89b9837
......@@ -7,7 +7,8 @@
---
````jsx
import { Form, Select, InputNumber, DatePicker, Switch, Slider, Button, message, Row, Col } from 'antd';
import { Form, Select, InputNumber, DatePicker, Switch,
Slider, Button, message, Row, Col, Upload, Icon } from 'antd';
const FormItem = Form.Item;
const Option = Select.Option;
......@@ -28,6 +29,17 @@ const Demo = React.createClass({
};
},
handleUpload(info) {
if (info.file.status !== 'uploading') {
console.log(info.file, info.fileList);
}
if (info.file.status === 'done') {
message.success(info.file.name + ' 上传成功。');
} else if (info.file.status === 'error') {
message.error(info.file.name + ' 上传失败。');
}
},
handleSubmit(e) {
e.preventDefault();
message.success('收到表单值~~~ :' + JSON.stringify(this.state.formData, function(k, v) {
......@@ -105,6 +117,17 @@ const Demo = React.createClass({
<DatePicker name="endDate" onChange={this.setValue.bind(this, 'endDate')} value={formData.endDate} />
</Col>
</FormItem>
<FormItem
label="logo图:"
labelCol={{span: 8}}
wrapperCol={{span: 16}}>
<Upload name="logo" action="/upload.do" listType="picture" onChange={this.handleUpload}>
<Button type="ghost">
<Icon type="upload" /> 点击上传
</Button>
</Upload>
<p>仅支持上传一张。</p>
</FormItem>
<Row>
<Col span="16" offset="8">
<Button type="primary" htmlType="submit">确定</Button>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册