From a415d0b384d4ef0eb67439e6dc66b924435fc01b Mon Sep 17 00:00:00 2001 From: Klein Date: Tue, 9 Jul 2024 16:31:49 +0800 Subject: [PATCH] =?UTF-8?q?perf(empty):=20=E4=BC=98=E5=8C=96=20image=20?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=20(#3129)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/packages/__VUE/empty/empty.taro.vue | 12 ++---------- src/packages/__VUE/empty/empty.vue | 12 ++---------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/src/packages/__VUE/empty/empty.taro.vue b/src/packages/__VUE/empty/empty.taro.vue index f2e7c3d9a9..c2c12a0a38 100644 --- a/src/packages/__VUE/empty/empty.taro.vue +++ b/src/packages/__VUE/empty/empty.taro.vue @@ -58,15 +58,7 @@ const style = computed(() => { return {} }) -const src = computed(() => { - if (props.image.startsWith('https://') || props.image.startsWith('http://') || props.image.startsWith('//')) { - return props.image - } else { - return defaultStatus[props.image] - } -}) +const src = computed(() => /^https?:\/\/|^\/\//.test(props.image) ? props.image : defaultStatus[props.image]) -const descriptionText = computed(() => { - return props.description || translate('noData') -}) +const descriptionText = computed(() => props.description || translate('noData')) diff --git a/src/packages/__VUE/empty/empty.vue b/src/packages/__VUE/empty/empty.vue index f2e7c3d9a9..c2c12a0a38 100644 --- a/src/packages/__VUE/empty/empty.vue +++ b/src/packages/__VUE/empty/empty.vue @@ -58,15 +58,7 @@ const style = computed(() => { return {} }) -const src = computed(() => { - if (props.image.startsWith('https://') || props.image.startsWith('http://') || props.image.startsWith('//')) { - return props.image - } else { - return defaultStatus[props.image] - } -}) +const src = computed(() => /^https?:\/\/|^\/\//.test(props.image) ? props.image : defaultStatus[props.image]) -const descriptionText = computed(() => { - return props.description || translate('noData') -}) +const descriptionText = computed(() => props.description || translate('noData'))