diff --git a/src/components/Form/src/helper.ts b/src/components/Form/src/helper.ts index 3e0136580d2..18d9f5b1f67 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',