Browse Source

fix: render dict

remotes/codeup-sync-origin/main
xingyu 3 years ago
parent
commit
30065de533
  1. 4
      src/components/DictTag/src/DictTag.vue
  2. 2
      src/components/Table/src/hooks/useRender.ts

4
src/components/DictTag/src/DictTag.vue

@ -51,11 +51,11 @@ export default defineComponent({
return null return null
} }
// 解决自定义字典标签值为零时标签不渲染的问题 // 解决自定义字典标签值为零时标签不渲染的问题
if (props.value === undefined) { if (props.value === undefined && props.value !== null) {
return null return null
} }
getDictObj(props.type, props.value.toString()) getDictObj(props.type, props.value.toString())
// 添加标签的文字颜色为白色,解决自定义背景颜色时标签文字看不清的问题 && isHexColor(dictData.value?.cssClass) // 添加标签的文字颜色为白色,解决自定义背景颜色时标签文字看不清的问题 && isHexColor(dictData.value?.cssClass)
return ( return (
<Tag <Tag
color={ color={

2
src/components/Table/src/hooks/useRender.ts

@ -94,7 +94,7 @@ export const useRender = {
*/ */
renderDict: (text, type, dictType?) => { renderDict: (text, type, dictType?) => {
if (type) { if (type) {
return h(DictTag, { type: type, value: text || '', dictType: dictType || 'number' }) return h(DictTag, { type: type, value: text !== null ? text : '', dictType: dictType || 'number' })
} }
return '' return ''
}, },