zhangshujun
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
7 additions and
1 deletions
-
src/components/Form/src/hooks/useFormEvents.ts
|
|
|
@ -210,7 +210,13 @@ export function useFormEvents({ |
|
|
|
first = false, |
|
|
|
) { |
|
|
|
const schemaList: FormSchema[] = cloneDeep(unref(getSchema)); |
|
|
|
|
|
|
|
const addSchemaIds: string[] = Array.isArray(schema) |
|
|
|
? schema.map((item) => item.field) |
|
|
|
: [schema.field]; |
|
|
|
if (schemaList.find((item) => addSchemaIds.includes(item.field))) { |
|
|
|
error('There are schemas that have already been added'); |
|
|
|
return; |
|
|
|
} |
|
|
|
const index = schemaList.findIndex((schema) => schema.field === prefixField); |
|
|
|
const _schemaList = isObject(schema) ? [schema as FormSchema] : (schema as FormSchema[]); |
|
|
|
if (!prefixField || index === -1 || first) { |
|
|
|
|