Image: Fix preview dose not show when preview list not contain src issue (#18975) (#19130)

pull/19155/head
luckyCao 2020-04-10 17:25:18 +08:00 committed by GitHub
parent bc7dcc6281
commit 7259a83852
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -94,7 +94,12 @@
return Array.isArray(previewSrcList) && previewSrcList.length > 0; return Array.isArray(previewSrcList) && previewSrcList.length > 0;
}, },
imageIndex() { imageIndex() {
return this.previewSrcList.indexOf(this.src); let previewIndex = 0;
const srcIndex = this.previewSrcList.indexOf(this.src);
if (srcIndex >= 0) {
previewIndex = srcIndex;
}
return previewIndex;
} }
}, },