From 83b09f09ffafb2a6273a1c5274e22f842c202c32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=96=E6=B2=9B=E9=92=8A?= <1269127639@qq.com> Date: Wed, 4 Oct 2023 22:36:18 +0800 Subject: [PATCH 1/2] fix(Descriptions): Add a default value --- src/components/Descriptions/src/Descriptions.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/Descriptions/src/Descriptions.vue b/src/components/Descriptions/src/Descriptions.vue index 40fdc25..66dad8b 100644 --- a/src/components/Descriptions/src/Descriptions.vue +++ b/src/components/Descriptions/src/Descriptions.vue @@ -16,6 +16,8 @@ const { getPrefixCls } = useDesign() const prefixCls = getPrefixCls('descriptions') +const defaultData = '-' + export default defineComponent({ name: 'Descriptions', props: { @@ -115,7 +117,7 @@ export default defineComponent({ default: () => item.slots?.default ? item.slots?.default(props.data) - : get(props.data, item.field) + : get(props.data, item.field) ?? defaultData }} ) From 4d14246de50d2ba9d652ec5ef038f4fd3597006a Mon Sep 17 00:00:00 2001 From: kailong321200875 <321200875@qq.com> Date: Sat, 7 Oct 2023 14:55:03 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E5=8E=BB=E9=99=A4=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E5=8F=B0=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/propTypes.ts | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/utils/propTypes.ts b/src/utils/propTypes.ts index e211c09..863f55c 100644 --- a/src/utils/propTypes.ts +++ b/src/utils/propTypes.ts @@ -1,11 +1,22 @@ -import VueTypes, { toType } from 'vue-types' -import { CSSProperties, PropType } from 'vue' +import { VueTypeValidableDef, VueTypesInterface, createTypes, toValidableType } from 'vue-types' +import { CSSProperties } from 'vue' -class propTypes extends VueTypes { +type PropTypes = VueTypesInterface & { + readonly style: VueTypeValidableDef +} +const newPropTypes = createTypes({ + func: undefined, + bool: undefined, + string: undefined, + number: undefined, + object: undefined, + integer: undefined +}) as PropTypes + +class propTypes extends newPropTypes { static get style() { - return toType('style', { - type: [String, Object] as PropType<[string | CSSProperties]>, - default: undefined + return toValidableType('style', { + type: [String, Object] }) } }