ant-design/components/upload/demo/multiple.md

36 lines
708 B
Markdown
Raw Normal View History

2015-09-08 17:26:32 +08:00
# 多文件选择
- order: 5
2016-01-13 22:32:42 +08:00
- hidden: 5
2015-09-08 17:26:32 +08:00
按住 ctrl 可选择多个文件,`ie10+` 支持。
---
````jsx
import { Upload, message, Button, Icon } from 'antd';
2015-09-08 17:26:32 +08:00
const props = {
2015-09-08 17:26:32 +08:00
action: '/upload.do',
multiple: true,
onChange(info) {
if (info.file.status !== 'uploading') {
console.log(info.file, info.fileList);
}
2015-09-08 18:05:55 +08:00
if (info.file.status === 'done') {
message.success(`${info.file.name} 上传成功。`);
2015-09-14 00:28:39 +08:00
} else if (info.file.status === 'error') {
message.error(`${info.file.name} 上传失败。`);
2015-09-08 18:05:55 +08:00
}
2015-09-08 17:26:32 +08:00
}
};
2015-10-20 16:47:55 +08:00
ReactDOM.render(
2015-09-08 17:26:32 +08:00
<Upload {...props}>
<Button type="ghost">
2015-10-02 16:52:34 +08:00
<Icon type="upload" /> 点击上传
</Button>
2015-09-08 17:26:32 +08:00
</Upload>
, mountNode);
2015-09-08 17:26:32 +08:00
````