From 1d2f37bfe138fcbfa316d817a8b8fbccdf0ba2be Mon Sep 17 00:00:00 2001 From: RuoYi Date: Mon, 15 Aug 2022 12:07:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9B=BE=E7=89=87=E9=A2=84?= =?UTF-8?q?=E8=A7=88=E7=BB=84=E4=BB=B6src=E5=B1=9E=E6=80=A7=E4=B8=BAnull?= =?UTF-8?q?=E5=80=BC=E6=8E=A7=E5=88=B6=E5=8F=B0=E6=8A=A5=E9=94=99=E9=97=AE?= =?UTF-8?q?=E9=A2=98(I5KBAS)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ImagePreview/index.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 @@ import { isExternal } from "@/utils/validate"; const props = defineProps({ src: { type: String, - required: true + default: "" }, width: { type: [Number, String], @@ -33,6 +33,9 @@ const props = defineProps({ }); 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 realSrc = computed(() => { }); const realSrcList = computed(() => { + if (!props.src) { + return; + } let real_src_list = props.src.split(","); let srcList = []; real_src_list.forEach(item => {