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
|
2015-10-28 20:55:49 +08:00
|
|
|
import { Upload, message, Button, Icon } from 'antd';
|
2015-09-08 17:26:32 +08:00
|
|
|
|
2015-10-28 20:55:49 +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') {
|
2016-02-17 18:04:42 +08:00
|
|
|
message.success(`${info.file.name} 上传成功。`);
|
2015-09-14 00:28:39 +08:00
|
|
|
} else if (info.file.status === 'error') {
|
2016-02-17 18:04:42 +08:00
|
|
|
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}>
|
2015-10-08 15:13:04 +08:00
|
|
|
<Button type="ghost">
|
2015-10-02 16:52:34 +08:00
|
|
|
<Icon type="upload" /> 点击上传
|
2015-10-08 15:13:04 +08:00
|
|
|
</Button>
|
2015-09-08 17:26:32 +08:00
|
|
|
</Upload>
|
2015-12-29 12:08:58 +08:00
|
|
|
, mountNode);
|
2015-09-08 17:26:32 +08:00
|
|
|
````
|