ant-design-vue/components/upload/demo/picture-style.md

74 lines
2.1 KiB
Markdown
Raw Normal View History

2018-04-13 08:19:50 +00:00
<cn>
#### 图片列表样式
上传文件为图片,可展示本地缩略图。`IE8/9` 不支持浏览器本地缩略图展示([Ref](https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsDataURL)),可以写 `thumbUrl` 属性来代替。
</cn>
<us>
#### Pictures with list style
If uploaded file is a picture, the thumbnail can be shown. `IE8/9` do not support local thumbnail show. Please use `thumbUrl` instead.
</us>
2019-10-09 10:32:23 +00:00
```tpl
2018-04-13 08:19:50 +00:00
<template>
<div>
<a-upload
2019-05-25 10:24:22 +00:00
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
2018-07-03 02:22:03 +00:00
listType="picture"
2018-04-13 08:19:50 +00:00
:defaultFileList="fileList"
>
2019-09-28 12:45:07 +00:00
<a-button> <a-icon type="upload" /> upload </a-button>
2018-04-13 08:19:50 +00:00
</a-upload>
<br />
<br />
<a-upload
2019-05-25 10:24:22 +00:00
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
2018-04-13 08:19:50 +00:00
listType="picture"
:defaultFileList="fileList"
class="upload-list-inline"
>
2019-09-28 12:45:07 +00:00
<a-button> <a-icon type="upload" /> upload </a-button>
2018-04-13 08:19:50 +00:00
</a-upload>
</div>
</template>
<script>
2019-09-28 12:45:07 +00:00
export default {
data() {
return {
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',
status: 'done',
url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
thumbUrl:
'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
},
],
};
},
};
2018-04-13 08:19:50 +00:00
</script>
<style scoped>
/* tile uploaded pictures */
2018-07-03 02:22:03 +00:00
.upload-list-inline >>> .ant-upload-list-item {
2018-04-13 08:19:50 +00:00
float: left;
width: 200px;
margin-right: 8px;
}
2018-07-03 02:22:03 +00:00
.upload-list-inline >>> .ant-upload-animate-enter {
2018-04-13 08:19:50 +00:00
animation-name: uploadAnimateInlineIn;
}
2018-07-03 02:22:03 +00:00
.upload-list-inline >>> .ant-upload-animate-leave {
2018-04-13 08:19:50 +00:00
animation-name: uploadAnimateInlineOut;
}
</style>
```