From cc4a99c47db9886032f9ab749a9da590d9648d31 Mon Sep 17 00:00:00 2001 From: xingyu4j Date: Tue, 21 Oct 2025 14:40:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20desc=20=E6=94=AF=E6=8C=81=20=E5=B5=8C?= =?UTF-8?q?=E5=A5=97=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/description/description.vue | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/apps/web-antd/src/components/description/description.vue b/apps/web-antd/src/components/description/description.vue index 0953d53ee..057f9db03 100644 --- a/apps/web-antd/src/components/description/description.vue +++ b/apps/web-antd/src/components/description/description.vue @@ -5,9 +5,9 @@ import type { CSSProperties, PropType, Slots } from 'vue'; import type { DescriptionItemSchema, DescriptionProps } from './typing'; -import { computed, defineComponent, ref, toRefs, unref, useAttrs } from 'vue'; +import { computed, defineComponent, ref, unref, useAttrs } from 'vue'; -import { get, isFunction } from '@vben/utils'; +import { get, getNestedValue, isFunction } from '@vben/utils'; import { Card, Descriptions } from 'ant-design-vue'; @@ -110,15 +110,17 @@ export default defineComponent({ if (!_data) { return null; } - const getField = get(_data, field); - if ( - getField && - !Object.prototype.hasOwnProperty.call(toRefs(_data), field) - ) { - return isFunction(render) ? render!('', _data) : ''; - } + const getField = field.includes('.') + ? (getNestedValue(_data, field) ?? get(_data, field)) + : get(_data, field); + // if ( + // getField && + // !Object.prototype.hasOwnProperty.call(toRefs(_data), field) + // ) { + // return isFunction(render) ? render('', _data) : (getField ?? ''); + // } return isFunction(render) - ? render!(getField, _data) + ? render(getField, _data) : (getField ?? ''); }