From 3b2760ca3ae5b51989ea7e97713f629a567fe53a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=B0=8F=E6=B0=91?= Date: Thu, 16 Nov 2023 10:00:13 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20defaultValue=E7=B1=BB=E5=9E=8B=E4=B8=BAn?= =?UTF-8?q?umber=E6=97=B6=E7=9A=84bug=20(#3288)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Form/src/helper.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/components/Form/src/helper.ts b/src/components/Form/src/helper.ts index 3e013658..18d9f5b1 100644 --- a/src/components/Form/src/helper.ts +++ b/src/components/Form/src/helper.ts @@ -61,9 +61,17 @@ export function processDateValue(attr: Recordable, component: string) { } } +export const defaultValueComponents = [ + 'Input', + 'InputPassword', + 'InputNumber', + 'InputSearch', + 'InputTextArea', +]; + export function handleInputNumberValue(component?: ComponentType, val?: any) { if (!component) return val; - if (['Input', 'InputPassword', 'InputSearch', 'InputTextArea'].includes(component)) { + if (defaultValueComponents.includes(component)) { return val && isNumber(val) ? `${val}` : val; } return val; @@ -74,8 +82,6 @@ export function handleInputNumberValue(component?: ComponentType, val?: any) { */ export const dateItemType = genType(); -export const defaultValueComponents = ['Input', 'InputPassword', 'InputSearch', 'InputTextArea']; - // TODO 自定义组件封装会出现验证问题,因此这里目前改成手动触发验证 export const NO_AUTO_LINK_COMPONENTS: ComponentType[] = [ 'Upload',