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

37 lines
713 B
Markdown
Raw Normal View History

2016-03-31 09:40:55 +08:00
---
order: 5
hidden: 5
title: 多文件选择
---
2015-09-08 17:26:32 +08:00
按住 ctrl 可选择多个文件,`ie10+` 支持。
2016-03-31 09:40:55 +08:00
2015-09-08 17:26:32 +08:00
````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
````