Commit 4909a4cb25ee62661e38cac38a8c3a388fdabbdf
1 parent
1d0ec362
fix(descriotion): fix type #228
Showing
2 changed files
with
7 additions
and
3 deletions
src/components/Description/src/index.tsx
1 | 1 | import type { DescOptions, DescInstance, DescItem } from './types'; |
2 | 2 | |
3 | 3 | import { defineComponent, computed, ref, unref, CSSProperties } from 'vue'; |
4 | +import { get } from 'lodash-es'; | |
4 | 5 | import { Descriptions } from 'ant-design-vue'; |
5 | 6 | import { DescriptionsProps } from 'ant-design-vue/es/descriptions/index'; |
6 | 7 | import { CollapseContainer, CollapseContainerOptions } from '/@/components/Container/index'; |
... | ... | @@ -91,8 +92,11 @@ export default defineComponent({ |
91 | 92 | return null; |
92 | 93 | } |
93 | 94 | |
94 | - const getContent = () => | |
95 | - isFunction(render) ? render(data?.[field], data) : unref(data) && unref(data)[field]; | |
95 | + const getContent = () => { | |
96 | + const _data = unref(data); | |
97 | + const getField = get(_data, field); | |
98 | + return isFunction(render) ? render(getField, _data) : getField ?? ''; | |
99 | + }; | |
96 | 100 | |
97 | 101 | const width = contentMinWidth; |
98 | 102 | return ( | ... | ... |
src/components/Description/src/types.ts