|
|
@ -31,7 +31,7 @@ export default function getElementByJson( |
|
|
|
const elements: IFormItem[] = [] |
|
|
|
const elements: IFormItem[] = [] |
|
|
|
for (const item of json) { |
|
|
|
for (const item of json) { |
|
|
|
const mergedItem = isFunction(item) ? item() : item |
|
|
|
const mergedItem = isFunction(item) ? item() : item |
|
|
|
const { name, value, field, validate, ...rest } = mergedItem |
|
|
|
const { name, value, field, children, validate, ...rest } = mergedItem |
|
|
|
if (value || value === 0) { |
|
|
|
if (value || value === 0) { |
|
|
|
fields[field] = value |
|
|
|
fields[field] = value |
|
|
|
initialValues[field] = value |
|
|
|
initialValues[field] = value |
|
|
@ -41,7 +41,7 @@ export default function getElementByJson( |
|
|
|
showLabel: !!name, |
|
|
|
showLabel: !!name, |
|
|
|
...omit(rest, ['type', 'props', 'options']), |
|
|
|
...omit(rest, ['type', 'props', 'options']), |
|
|
|
label: name, |
|
|
|
label: name, |
|
|
|
path: field, |
|
|
|
path: !children ? field : '', |
|
|
|
widget: () => getField(item, fields, rules), |
|
|
|
widget: () => getField(item, fields, rules), |
|
|
|
span: toRef(mergedItem, 'span') as Ref<number> |
|
|
|
span: toRef(mergedItem, 'span') as Ref<number> |
|
|
|
} |
|
|
|
} |
|
|
|