From f5a16e4534b815471fdd22edab89a010d492c4aa Mon Sep 17 00:00:00 2001 From: RuoYi <yzz_ivy@163.com> Date: 星期五, 28 十月 2022 20:13:44 +0800 Subject: [PATCH] 修复使用透明底png图片时,自动填充黑色背景 --- src/components/ImagePreview/index.vue | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/src/components/ImagePreview/index.vue b/src/components/ImagePreview/index.vue index cd6a157..26380bb 100644 --- a/src/components/ImagePreview/index.vue +++ b/src/components/ImagePreview/index.vue @@ -20,7 +20,7 @@ const props = defineProps({ src: { type: String, - required: true + default: "" }, width: { type: [Number, String], @@ -33,6 +33,9 @@ }); const realSrc = computed(() => { + if (!props.src) { + return; + } let real_src = props.src.split(",")[0]; if (isExternal(real_src)) { return real_src; @@ -41,6 +44,9 @@ }); const realSrcList = computed(() => { + if (!props.src) { + return; + } let real_src_list = props.src.split(","); let srcList = []; real_src_list.forEach(item => { -- Gitblit v1.9.3