fix(Uploader): incorrect preview index when upload same images (#4577)

This commit is contained in:
neverland 2019-09-25 21:33:55 +08:00 committed by GitHub
parent 306d595fbd
commit 8740376218
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -183,14 +183,13 @@ export default createComponent({
return; return;
} }
const imageFiles = this.fileList const imageFiles = this.fileList.filter(item => isImageFile(item));
.filter(item => isImageFile(item)) const imageContents = imageFiles.map(item => item.content || item.url);
.map(item => item.content || item.url);
ImagePreview({ ImagePreview({
images: imageFiles, images: imageContents,
closeOnPopstate: true, closeOnPopstate: true,
startPosition: imageFiles.indexOf(item.content || item.url), startPosition: imageFiles.indexOf(item),
onClose: () => { onClose: () => {
this.$emit('close-preview'); this.$emit('close-preview');
} }