2016-03-31 09:40:55 +08:00
|
|
|
---
|
2018-06-12 16:03:54 +08:00
|
|
|
order: 8
|
2016-08-25 09:46:19 +08:00
|
|
|
title:
|
|
|
|
zh-CN: 图片列表样式
|
|
|
|
en-US: Pictures with list style
|
2016-03-31 09:40:55 +08:00
|
|
|
---
|
2015-12-12 15:25:54 +08:00
|
|
|
|
2016-08-25 09:46:19 +08:00
|
|
|
## zh-CN
|
|
|
|
|
|
|
|
上传文件为图片,可展示本地缩略图。`IE8/9` 不支持浏览器本地缩略图展示([Ref](https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsDataURL)),可以写 `thumbUrl` 属性来代替。
|
|
|
|
|
|
|
|
## en-US
|
|
|
|
|
2017-08-01 18:22:55 +08:00
|
|
|
If uploaded file is a picture, the thumbnail can be shown. `IE8/9` do not support local thumbnail show. Please use `thumbUrl` instead.
|
2016-08-25 09:46:19 +08:00
|
|
|
|
2019-05-07 14:57:32 +08:00
|
|
|
```jsx
|
2019-08-13 14:07:17 +08:00
|
|
|
import { Upload, Button } from 'antd';
|
2019-11-28 12:34:33 +08:00
|
|
|
import { UploadOutlined } from '@ant-design/icons';
|
2015-12-12 15:25:54 +08:00
|
|
|
|
2019-05-07 14:57:32 +08:00
|
|
|
const fileList = [
|
|
|
|
{
|
|
|
|
uid: '-1',
|
|
|
|
name: 'xxx.png',
|
|
|
|
status: 'done',
|
|
|
|
url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
|
|
|
|
thumbUrl: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
uid: '-2',
|
|
|
|
name: 'yyy.png',
|
2019-11-12 21:45:32 +08:00
|
|
|
status: 'error',
|
2019-05-07 14:57:32 +08:00
|
|
|
},
|
|
|
|
];
|
2017-03-08 14:42:34 +08:00
|
|
|
|
2015-12-12 15:25:54 +08:00
|
|
|
const props = {
|
2019-04-30 16:10:00 +08:00
|
|
|
action: 'https://www.mocky.io/v2/5cc8019d300000980a055e76',
|
2015-12-12 15:25:54 +08:00
|
|
|
listType: 'picture',
|
2017-03-08 14:42:34 +08:00
|
|
|
defaultFileList: [...fileList],
|
|
|
|
};
|
|
|
|
|
|
|
|
const props2 = {
|
2019-04-30 16:10:00 +08:00
|
|
|
action: 'https://www.mocky.io/v2/5cc8019d300000980a055e76',
|
2017-03-08 14:42:34 +08:00
|
|
|
listType: 'picture',
|
|
|
|
defaultFileList: [...fileList],
|
|
|
|
className: 'upload-list-inline',
|
2015-12-12 15:25:54 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
ReactDOM.render(
|
2016-04-29 12:13:27 +08:00
|
|
|
<div>
|
|
|
|
<Upload {...props}>
|
2017-02-04 22:35:33 +08:00
|
|
|
<Button>
|
2019-11-28 12:34:33 +08:00
|
|
|
<UploadOutlined /> Upload
|
2016-04-29 12:13:27 +08:00
|
|
|
</Button>
|
|
|
|
</Upload>
|
|
|
|
<br />
|
|
|
|
<br />
|
2017-03-08 14:42:34 +08:00
|
|
|
<Upload {...props2}>
|
2017-02-04 22:35:33 +08:00
|
|
|
<Button>
|
2019-11-28 12:34:33 +08:00
|
|
|
<UploadOutlined /> Upload
|
2016-04-29 12:13:27 +08:00
|
|
|
</Button>
|
|
|
|
</Upload>
|
2018-06-27 15:55:04 +08:00
|
|
|
</div>,
|
2019-05-07 14:57:32 +08:00
|
|
|
mountNode,
|
2018-11-28 15:00:03 +08:00
|
|
|
);
|
2019-05-07 14:57:32 +08:00
|
|
|
```
|
2016-01-13 22:43:55 +08:00
|
|
|
|
2019-05-07 14:57:32 +08:00
|
|
|
```css
|
2016-08-25 09:46:19 +08:00
|
|
|
/* tile uploaded pictures */
|
2016-01-13 22:43:55 +08:00
|
|
|
.upload-list-inline .ant-upload-list-item {
|
2017-03-08 18:02:15 +08:00
|
|
|
float: left;
|
2016-01-13 22:43:55 +08:00
|
|
|
width: 200px;
|
|
|
|
margin-right: 8px;
|
|
|
|
}
|
2017-03-08 18:02:15 +08:00
|
|
|
.upload-list-inline .ant-upload-animate-enter {
|
|
|
|
animation-name: uploadAnimateInlineIn;
|
|
|
|
}
|
|
|
|
.upload-list-inline .ant-upload-animate-leave {
|
|
|
|
animation-name: uploadAnimateInlineOut;
|
|
|
|
}
|
2019-05-07 14:57:32 +08:00
|
|
|
```
|