2016-03-31 09:40:55 +08:00
|
|
|
---
|
|
|
|
order: 6
|
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
|
|
|
|
|
|
|
|
If uploade file is picture, a thumbnail can be shown. `IE8/9` do not support local thumbnail show. Please use `thumbUrl` instead.
|
|
|
|
|
2015-12-27 15:32:37 +08:00
|
|
|
|
2017-01-19 15:19:03 +08:00
|
|
|
````__react
|
2015-12-12 15:25:54 +08:00
|
|
|
import { Upload, Button, Icon } from 'antd';
|
|
|
|
|
|
|
|
const props = {
|
|
|
|
action: '/upload.do',
|
|
|
|
listType: 'picture',
|
|
|
|
defaultFileList: [{
|
|
|
|
uid: -1,
|
|
|
|
name: 'xxx.png',
|
|
|
|
status: 'done',
|
2016-11-22 14:21:42 +08:00
|
|
|
url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
|
|
|
|
thumbUrl: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
|
2015-12-12 15:25:54 +08:00
|
|
|
}, {
|
|
|
|
uid: -2,
|
|
|
|
name: 'yyy.png',
|
|
|
|
status: 'done',
|
2016-11-22 14:21:42 +08:00
|
|
|
url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
|
|
|
|
thumbUrl: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
|
2016-05-11 09:32:33 +08:00
|
|
|
}],
|
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>
|
2016-08-25 09:46:19 +08:00
|
|
|
<Icon type="upload" /> upload
|
2016-04-29 12:13:27 +08:00
|
|
|
</Button>
|
|
|
|
</Upload>
|
|
|
|
<br />
|
|
|
|
<br />
|
|
|
|
<Upload {...props} className="upload-list-inline">
|
2017-02-04 22:35:33 +08:00
|
|
|
<Button>
|
2016-08-25 09:46:19 +08:00
|
|
|
<Icon type="upload" /> upload
|
2016-04-29 12:13:27 +08:00
|
|
|
</Button>
|
|
|
|
</Upload>
|
|
|
|
</div>
|
2015-12-29 12:08:58 +08:00
|
|
|
, mountNode);
|
2015-12-12 15:25:54 +08:00
|
|
|
````
|
2016-01-13 22:43:55 +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 {
|
|
|
|
display: inline-block;
|
|
|
|
width: 200px;
|
|
|
|
margin-right: 8px;
|
|
|
|
}
|
|
|
|
````
|