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 a633a85af..3664964b8 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 @@ -84,7 +84,7 @@ export const FormItem: any = observer((props: any) => { `, { [css` - & .ant-formily-item-label { + > .ant-formily-item-label { display: none; } `]: showTitle === false, diff --git a/packages/core/client/src/schema-items/GeneralSchemaItems.tsx b/packages/core/client/src/schema-items/GeneralSchemaItems.tsx index fb57f4a74..6cd7d60f6 100644 --- a/packages/core/client/src/schema-items/GeneralSchemaItems.tsx +++ b/packages/core/client/src/schema-items/GeneralSchemaItems.tsx @@ -1,5 +1,5 @@ import { Field } from '@formily/core'; -import { ISchema, useField, useFieldSchema } from '@formily/react'; +import { ISchema, useField, useFieldSchema,observer } from '@formily/react'; import _ from 'lodash'; import { useTranslation } from 'react-i18next'; import React from 'react'; @@ -9,7 +9,7 @@ import { SchemaSettings } from '../schema-settings'; export const GeneralSchemaItems: React.FC<{ required?: boolean; -}> = (props) => { +}> = observer((props) => { const { required = true } = props; const { getCollectionJoinField } = useCollectionManager(); const { getField } = useCollection(); @@ -18,7 +18,7 @@ export const GeneralSchemaItems: React.FC<{ const { t } = useTranslation(); const { dn, refresh } = useDesignable(); const collectionField = getField(fieldSchema['name']) || getCollectionJoinField(fieldSchema['x-collection-field']); - +console.log(field,field.decoratorProps ) return ( <> {collectionField && ( @@ -60,6 +60,8 @@ export const GeneralSchemaItems: React.FC<{ checked={field.decoratorProps.showTitle ?? true} title={t('Display title')} onChange={(checked) => { + fieldSchema['x-decorator-props'] = fieldSchema['x-decorator-props'] || {}; + fieldSchema['x-decorator-props']['showTitle'] = checked; field.decoratorProps.showTitle = checked; dn.emit('patch', { schema: { @@ -158,4 +160,4 @@ export const GeneralSchemaItems: React.FC<{ )} ); -}; +});