From 7259a83852802eace35dc8cedcaa17340c9aab0c Mon Sep 17 00:00:00 2001 From: luckyCao Date: Fri, 10 Apr 2020 17:25:18 +0800 Subject: [PATCH] Image: Fix preview dose not show when preview list not contain src issue (#18975) (#19130) --- packages/image/src/main.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/image/src/main.vue b/packages/image/src/main.vue index 4ff52d08504..211fb086b15 100644 --- a/packages/image/src/main.vue +++ b/packages/image/src/main.vue @@ -94,7 +94,12 @@ return Array.isArray(previewSrcList) && previewSrcList.length > 0; }, imageIndex() { - return this.previewSrcList.indexOf(this.src); + let previewIndex = 0; + const srcIndex = this.previewSrcList.indexOf(this.src); + if (srcIndex >= 0) { + previewIndex = srcIndex; + } + return previewIndex; } },