mirror of https://github.com/ElemeFE/element
support upload default fileList (#1393)
parent
58098f5693
commit
f88ad25f7b
|
@ -102,6 +102,7 @@ This mode is specifically for image uploading, and the thumbnail will display in
|
||||||
:thumbnail-mode="true"
|
:thumbnail-mode="true"
|
||||||
:on-preview="handlePreview"
|
:on-preview="handlePreview"
|
||||||
:on-remove="handleRemove"
|
: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>
|
<i class="el-icon-upload"></i>
|
||||||
<div class="el-dragger__text">Drop file here or <em>click to upload</em></div>
|
<div class="el-dragger__text">Drop file here or <em>click to upload</em></div>
|
||||||
|
|
|
@ -113,6 +113,7 @@
|
||||||
:thumbnail-mode="true"
|
:thumbnail-mode="true"
|
||||||
:on-preview="handlePreview"
|
:on-preview="handlePreview"
|
||||||
:on-remove="handleRemove"
|
: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>
|
<i class="el-icon-upload"></i>
|
||||||
<div class="el-dragger__text">将文件拖到此处,或<em>点击上传</em></div>
|
<div class="el-dragger__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||||
|
|
|
@ -145,7 +145,7 @@
|
||||||
& img {
|
& img {
|
||||||
display: block;
|
display: block;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: auto;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
@e progress {
|
@e progress {
|
||||||
|
|
|
@ -65,6 +65,12 @@ export default {
|
||||||
onError: {
|
onError: {
|
||||||
type: Function,
|
type: Function,
|
||||||
default: noop
|
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) {
|
render(h) {
|
||||||
var uploadList;
|
var uploadList;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue