fix: enable link style

This commit is contained in:
katherinehhh 2023-05-10 21:08:46 +08:00
parent aa7fc12f99
commit 2eab58e1ba
2 changed files with 5 additions and 3 deletions

View File

@ -25,6 +25,7 @@ const toValue = (value, placeholder) => {
export const ReadPrettyInternalViewer: React.FC = observer((props: any) => {
const fieldSchema = useFieldSchema();
const recordCtx = useRecord();
const { enableLink } = fieldSchema['x-component-props'];
const { getCollectionJoinField } = useCollectionManager();
// value 做了转换,但 props.value 和原来 useField().value 的值不一致
const field = useField();
@ -50,7 +51,7 @@ export const ReadPrettyInternalViewer: React.FC = observer((props: any) => {
<span>
{snapshot || isTagsMode ? (
text
) : (
) : enableLink!==false ? (
<a
onClick={(e) => {
e.stopPropagation();
@ -63,6 +64,8 @@ export const ReadPrettyInternalViewer: React.FC = observer((props: any) => {
>
{text}
</a>
) : (
text
)}
</span>
{index < arr.length - 1 ? <span style={{ marginRight: 4, color: '#aaa' }}>,</span> : null}

View File

@ -33,9 +33,8 @@ export const ReadPretty = observer((props: any) => {
}
return (
<AssociationFieldProvider>
{['Select', 'Picker'].includes(currentMode) && enableLink !== false && <ReadPrettyInternalViewer {...props} />}
{['Select', 'Picker'].includes(currentMode) && <ReadPrettyInternalViewer {...props} />}
{currentMode === 'Nester' && <InternalNester {...props} />}
{['Select', 'Picker'].includes(currentMode) && enableLink === false && <AssociationSelectReadPretty {...props} />}
{currentMode === 'SubTable' && <InternalSubTable {...props} />}
{currentMode === 'FileManager' && <FileManageReadPretty {...props} />}
</AssociationFieldProvider>