refactor:优化部分警告

This commit is contained in:
秋帆
2024-06-02 16:06:32 +08:00
parent 0f3d927f98
commit 4186201837
4 changed files with 10 additions and 8 deletions

View File

@@ -25,14 +25,15 @@ const props = defineProps({
}
})
const dictItem = computed(() => {
const dictItem = computed((): LabelValueState => {
try {
return props.dict.find((d) => d.value === String(props.value) || d.value === Number(props.value))
return props.dict.find(
(d) => d.value === String(props.value) || d.value === Number(props.value)
) || { label: '', value: '' }
} catch (error) {
return []
return { label: '', value: '' }
}
}
)
})
</script>
<style lang="scss" scoped></style>