fix: defaultValue类型为number时的bug (#3288)

This commit is contained in:
黄小民 2023-11-16 10:00:13 +08:00 committed by GitHub
parent 100f3cf26c
commit 3b2760ca3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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',