support upload default fileList (#1393)

pull/1396/head
baiyaaaaa 2016-11-27 14:07:13 +08:00 committed by cinwell.li
parent 58098f5693
commit f88ad25f7b
4 changed files with 18 additions and 1 deletions

View File

@ -102,6 +102,7 @@ This mode is specifically for image uploading, and the thumbnail will display in
:thumbnail-mode="true"
:on-preview="handlePreview"
:on-remove="handleRemove"
:default-file-list="[{name: 'food.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}]"
>
<i class="el-icon-upload"></i>
<div class="el-dragger__text">Drop file here or <em>click to upload</em></div>

View File

@ -113,6 +113,7 @@
:thumbnail-mode="true"
:on-preview="handlePreview"
:on-remove="handleRemove"
:default-file-list="[{name: 'food.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}]"
>
<i class="el-icon-upload"></i>
<div class="el-dragger__text">将文件拖到此处,或<em>点击上传</em></div>

View File

@ -145,7 +145,7 @@
& img {
display: block;
width: 100%;
height: auto;
height: 100%;
}
@e progress {

View File

@ -65,6 +65,12 @@ export default {
onError: {
type: Function,
default: noop
},
defaultFileList: {
type: Array,
default() {
return [];
}
}
},
@ -152,6 +158,15 @@ export default {
}
},
created() {
this.fileList = this.defaultFileList.map(item => {
item.status = 'finished';
item.percentage = 100;
item.uid = Date.now() + this.tempIndex++;
return item;
});
},
render(h) {
var uploadList;