fix: tts show error message

This commit is contained in:
jialin
2024-11-29 17:03:46 +08:00
parent 4cfe41ca9e
commit d1a80e1a64
6 changed files with 64 additions and 20 deletions
+11 -2
View File
@@ -1,8 +1,8 @@
import { ParamsSchema } from '@/pages/playground/config/types';
import { useIntl } from '@umijs/max';
import React, { useCallback, useMemo } from 'react';
import LabelInfo from './components/label-info';
import componentsMap from './config/components';
const FieldComponent: React.FC<ParamsSchema> = (props) => {
const intl = useIntl();
const { type, label, attrs, style, value, ...rest } = props;
@@ -10,7 +10,16 @@ const FieldComponent: React.FC<ParamsSchema> = (props) => {
(type: string) => {
switch (type) {
case 'Checkbox':
return <span>{intl.formatMessage({ id: label.text })}</span>;
return (
<LabelInfo
required={props.required}
label={
label.isLocalized
? intl.formatMessage({ id: label.text })
: label.text
}
></LabelInfo>
);
default:
return null;
}