Skip to content

Commit

Permalink
perf(empty): 优化 image 校验 (#3129)
Browse files Browse the repository at this point in the history
  • Loading branch information
daiwanxing authored Jul 9, 2024
1 parent 139d695 commit a415d0b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
12 changes: 2 additions & 10 deletions src/packages/__VUE/empty/empty.taro.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
</script>
12 changes: 2 additions & 10 deletions src/packages/__VUE/empty/empty.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
</script>

0 comments on commit a415d0b

Please sign in to comment.