diff --git a/packages/core/client/src/schema-component/antd/form-item/FormItem.tsx b/packages/core/client/src/schema-component/antd/form-item/FormItem.tsx index 3607e887b..05cf804f8 100644 --- a/packages/core/client/src/schema-component/antd/form-item/FormItem.tsx +++ b/packages/core/client/src/schema-component/antd/form-item/FormItem.tsx @@ -69,7 +69,7 @@ export const FormItem: any = observer( } else if ( isVariable(schema?.default) && schema?.default?.includes('$context') && - collectionField.interface === 'm2m' + collectionField?.interface === 'm2m' ) { // 直接对多 const contextData = parseVariables('{{$context}}', variablesCtx); @@ -212,7 +212,7 @@ FormItem.Designer = function Designer() { const isPickerMode = fieldSchema['x-component-props']?.mode === 'Picker'; const showFieldMode = isAssociationField && fieldModeOptions && !isTableField; const showModeSelect = showFieldMode && isPickerMode; - const isDateField = ['datetime', 'createdAt', 'updatedAt'].includes(collectionField.interface); + const isDateField = ['datetime', 'createdAt', 'updatedAt'].includes(collectionField?.interface); return ( diff --git a/packages/core/client/src/schema-settings/SchemaSettings.tsx b/packages/core/client/src/schema-settings/SchemaSettings.tsx index 441bc4bf4..ab98a5bc1 100644 --- a/packages/core/client/src/schema-settings/SchemaSettings.tsx +++ b/packages/core/client/src/schema-settings/SchemaSettings.tsx @@ -1462,12 +1462,12 @@ SchemaSettings.DefaultValue = function DefaultvalueConfigure(props) { `${collectionField.target}.${fieldSchema['x-component-props']?.fieldNames?.label || 'id'}`, ); } - const parentFieldSchema = collectionField.interface === 'm2o' && findParentFieldSchema(fieldSchema); + const parentFieldSchema = collectionField?.interface === 'm2o' && findParentFieldSchema(fieldSchema); const parentCollectionField = parentFieldSchema && getCollectionJoinField(parentFieldSchema?.['x-collection-field']); const tableCtx = useTableBlockContext(); const isAllowContexVariable = - collectionField.interface === 'm2m' || - (parentCollectionField?.type === 'hasMany' && collectionField.interface === 'm2o'); + collectionField?.interface === 'm2m' || + (parentCollectionField?.type === 'hasMany' && collectionField?.interface === 'm2o'); return (