Browse Source
perf(util): remove handleInputNumberValue (#3806)
* perf(util): remove handleInputNumberValue
* fix: remove unuse fn
pull/3808/head
Electrolux
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
1 additions and
12 deletions
-
src/components/Form/src/helper.ts
-
src/components/Form/src/hooks/useFormEvents.ts
|
|
|
@ -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(); |
|
|
|
|
|
|
|
@ -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; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 时间字段 |
|
|
|
*/ |
|
|
|
|
|
|
|
@ -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'; |
|
|
|
@ -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') { |
|
|
|
|