Skip to content

Commit

Permalink
perf(util): remove handleInputNumberValue (#3806)
Browse files Browse the repository at this point in the history
* perf(util): remove handleInputNumberValue

* fix: remove unuse fn
  • Loading branch information
electroluxcode authored May 1, 2024
1 parent 08a1f7b commit ba5b8f8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
10 changes: 1 addition & 9 deletions src/components/Form/src/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Rule as ValidationRule } from 'ant-design-vue/lib/form/interface';
import type { ComponentType } from './types';
import { useI18n } from '@/hooks/web/useI18n';
import { dateUtil } from '@/utils/dateUtil';
import { isNumber, isObject } from '@/utils/is';
import { isObject } from '@/utils/is';

const { t } = useI18n();

Expand Down Expand Up @@ -69,14 +69,6 @@ export const defaultValueComponents = [
'InputTextArea',
];

export function handleInputNumberValue(component?: ComponentType, val?: any) {
if (!component) return val;
if (defaultValueComponents.includes(component)) {
return val && isNumber(val) ? val : `${val}`;
}
return val;
}

/**
* 时间字段
*/
Expand Down
3 changes: 0 additions & 3 deletions src/components/Form/src/hooks/useFormEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { isArray, isFunction, isObject, isString, isDef, isNil } from '@/utils/i
import { deepMerge } from '@/utils';
import {
dateItemType,
handleInputNumberValue,
defaultValueComponents,
isIncludeSimpleComponents,
} from '../helper';
Expand Down Expand Up @@ -79,8 +78,6 @@ export function useFormEvents({
const schema = unref(getSchema).find((item) => item.field === key);
let value = get(values, key);
const hasKey = has(values, key);

value = handleInputNumberValue(schema?.component, value);
const { componentProps } = schema || {};
let _props = componentProps as any;
if (typeof componentProps === 'function') {
Expand Down

0 comments on commit ba5b8f8

Please sign in to comment.