fix: dict tag

pull/12/head
xingyu 2023-05-11 10:24:14 +08:00
parent cfd4ac840e
commit c4d3b3efff
1 changed files with 8 additions and 1 deletions

View File

@ -27,6 +27,9 @@ export default defineComponent({
} else { } else {
dictOptions = getDictOptions(dictType) dictOptions = getDictOptions(dictType)
} }
if (dictOptions && dictOptions.length === 0) {
return
}
dictOptions.forEach((dict: DictDataType) => { dictOptions.forEach((dict: DictDataType) => {
if (dict.value === value) { if (dict.value === value) {
if (dict.colorType + '' === 'primary') { if (dict.colorType + '' === 'primary') {
@ -49,6 +52,10 @@ export default defineComponent({
return null return null
} }
getDictObj(props.type, props.value.toString()) getDictObj(props.type, props.value.toString())
if (dictData.value === undefined) {
return null
}
// && isHexColor(dictData.value?.cssClass) // && isHexColor(dictData.value?.cssClass)
return ( return (
<Tag <Tag
@ -60,7 +67,7 @@ export default defineComponent({
: '' : ''
} }
> >
{dictData.value?.label} {dictData.value?.label || ''}
</Tag> </Tag>
) )
} }