fix: defaultValue类型为number时的bug (#3288)
This commit is contained in:
parent
100f3cf26c
commit
3b2760ca3a
|
|
@ -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) {
|
export function handleInputNumberValue(component?: ComponentType, val?: any) {
|
||||||
if (!component) return val;
|
if (!component) return val;
|
||||||
if (['Input', 'InputPassword', 'InputSearch', 'InputTextArea'].includes(component)) {
|
if (defaultValueComponents.includes(component)) {
|
||||||
return val && isNumber(val) ? `${val}` : val;
|
return val && isNumber(val) ? `${val}` : val;
|
||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
|
|
@ -74,8 +82,6 @@ export function handleInputNumberValue(component?: ComponentType, val?: any) {
|
||||||
*/
|
*/
|
||||||
export const dateItemType = genType();
|
export const dateItemType = genType();
|
||||||
|
|
||||||
export const defaultValueComponents = ['Input', 'InputPassword', 'InputSearch', 'InputTextArea'];
|
|
||||||
|
|
||||||
// TODO 自定义组件封装会出现验证问题,因此这里目前改成手动触发验证
|
// TODO 自定义组件封装会出现验证问题,因此这里目前改成手动触发验证
|
||||||
export const NO_AUTO_LINK_COMPONENTS: ComponentType[] = [
|
export const NO_AUTO_LINK_COMPONENTS: ComponentType[] = [
|
||||||
'Upload',
|
'Upload',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue