Commit af54b0fbc6a69b77114f290514bd8d7c80c068ff

Authored by oooplz
Committed by GitHub
1 parent 4418eccf

feat: 多路径字段获取值 (#2664)

src/components/Form/src/hooks/useFormEvents.ts
... ... @@ -14,7 +14,7 @@ import {
14 14 import { deepMerge } from '/@/utils';
15 15 import { dateItemType, handleInputNumberValue, defaultValueComponents } from '../helper';
16 16 import { dateUtil } from '/@/utils/dateUtil';
17   -import { cloneDeep, set, uniqBy } from 'lodash-es';
  17 +import { cloneDeep, set, uniqBy, get } from 'lodash-es';
18 18 import { error } from '/@/utils/log';
19 19  
20 20 interface UseFormActionContext {
... ... @@ -112,9 +112,8 @@ export function useFormEvents({
112 112 const validKeys: string[] = [];
113 113 fields.forEach((key) => {
114 114 const schema = unref(getSchema).find((item) => item.field === key);
115   - let value = values[key];
116   -
117   - const hasKey = Reflect.has(values, key);
  115 + let value = get(values, key);
  116 + const hasKey = !!get(values, key);
118 117  
119 118 value = handleInputNumberValue(schema?.component, value);
120 119 const { componentProps } = schema || {};
... ...