Skip to content

Commit bc24a8a

Browse files
committed
perf: 优化empty 组件判断 image 是否为一个有效的资源链接
1 parent dd6b2bd commit bc24a8a

1 file changed

Lines changed: 2 additions & 10 deletions

File tree

‎src/packages/__VUE/empty/empty.taro.vue‎

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,7 @@ const style = computed(() => {
5858
return {}
5959
})
6060
61-
const src = computed(() => {
62-
if (props.image.startsWith('https://') || props.image.startsWith('http://') || props.image.startsWith('//')) {
63-
return props.image
64-
} else {
65-
return defaultStatus[props.image]
66-
}
67-
})
61+
const src = computed(() => /^https?:\/\/|^\/\//.test(props.image) ? props.image : defaultStatus[props.image])
6862
69-
const descriptionText = computed(() => {
70-
return props.description || translate('noData')
71-
})
63+
const descriptionText = computed(() => props.description || translate('noData'))
7264
</script>

0 commit comments

Comments
 (0)