Commit 23e0932883d148688cee5d24e09f2886a3f5aaeb
Committed by
GitHub
1 parent
8f2008ac
fix: 修复Description组件渲染function xxxx() { [native code] }的问题 (#1796)
* fix/description-render-prototype-methods * fix/description-render-prototype-methods
Showing
1 changed file
with
4 additions
and
1 deletions
src/components/Description/src/Description.vue
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | import type { DescriptionsProps } from 'ant-design-vue/es/descriptions/index'; | 3 | import type { DescriptionsProps } from 'ant-design-vue/es/descriptions/index'; |
4 | import type { CSSProperties } from 'vue'; | 4 | import type { CSSProperties } from 'vue'; |
5 | import type { CollapseContainerOptions } from '/@/components/Container/index'; | 5 | import type { CollapseContainerOptions } from '/@/components/Container/index'; |
6 | - import { defineComponent, computed, ref, unref } from 'vue'; | 6 | + import { defineComponent, computed, ref, unref, toRefs } from 'vue'; |
7 | import { get } from 'lodash-es'; | 7 | import { get } from 'lodash-es'; |
8 | import { Descriptions } from 'ant-design-vue'; | 8 | import { Descriptions } from 'ant-design-vue'; |
9 | import { CollapseContainer } from '/@/components/Container/index'; | 9 | import { CollapseContainer } from '/@/components/Container/index'; |
@@ -121,6 +121,9 @@ | @@ -121,6 +121,9 @@ | ||
121 | return null; | 121 | return null; |
122 | } | 122 | } |
123 | const getField = get(_data, field); | 123 | const getField = get(_data, field); |
124 | + if (getField && !toRefs(_data).hasOwnProperty(field)) { | ||
125 | + return isFunction(render) ? render('', _data) : ''; | ||
126 | + } | ||
124 | return isFunction(render) ? render(getField, _data) : getField ?? ''; | 127 | return isFunction(render) ? render(getField, _data) : getField ?? ''; |
125 | }; | 128 | }; |
126 | 129 |