From 43b2e315aa81275174b390448e748001a8d74ce0 Mon Sep 17 00:00:00 2001 From: Hooray Hu <304327508@qq.com> Date: Mon, 12 Aug 2024 09:29:09 +0800 Subject: [PATCH] =?UTF-8?q?SvgIcon=20=E7=BB=84=E4=BB=B6=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E4=BC=A0=E5=85=A5=E6=9C=AC=E5=9C=B0=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/SvgIcon/index.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/SvgIcon/index.vue b/src/components/SvgIcon/index.vue index 5bc0879..64c8df5 100755 --- a/src/components/SvgIcon/index.vue +++ b/src/components/SvgIcon/index.vue @@ -14,7 +14,10 @@ const props = defineProps<{ }>() const outputType = computed(() => { - if (/^https?:\/\//.test(props.name)) { + const hasPathFeatures = (str: string) => { + return /^\.{1,2}\//.test(str) || str.startsWith('/') || str.includes('/') + } + if (/^https?:\/\//.test(props.name) || hasPathFeatures(props.name)) { return 'img' } else if (/i-[^:]+:[^:]+/.test(props.name)) {