diff --git a/packages/amis-core/src/utils/labelToString.ts b/packages/amis-core/src/utils/labelToString.ts index 95acb60ba..e0af3d2e4 100644 --- a/packages/amis-core/src/utils/labelToString.ts +++ b/packages/amis-core/src/utils/labelToString.ts @@ -6,6 +6,8 @@ export function labelToString(label: any): string { return label; } else if (type === 'number') { return `${label}`; + } else if (label === 'boolean') { + return String(label); } if (isPlainObject(label)) { diff --git a/packages/amis-editor-core/src/component/base/SchemaForm.tsx b/packages/amis-editor-core/src/component/base/SchemaForm.tsx index 856e659b7..e64fb8195 100644 --- a/packages/amis-editor-core/src/component/base/SchemaForm.tsx +++ b/packages/amis-editor-core/src/component/base/SchemaForm.tsx @@ -101,8 +101,6 @@ export function SchemaFrom({ return schema; }, [body, controls, submitOnChange]); - const [init, setInit] = React.useState(true); - const themeConfig = React.useMemo(() => getThemeConfig(), []); const submitSubscribers = React.useRef>([]); const subscribeSubmit = React.useCallback( @@ -149,8 +147,7 @@ export function SchemaFrom({ newValue = pipeOut ? await pipeOut(newValue, value) : newValue; const diffValue = diff(value, newValue); // 没有变化时不触发onChange - if (!diffValue || init) { - setInit(false); + if (!diffValue) { return; } onChange(newValue, diffValue, (schema, value, id, diff) => { diff --git a/packages/amis/src/renderers/Form/Select.tsx b/packages/amis/src/renderers/Form/Select.tsx index 55162f03b..b1f249221 100644 --- a/packages/amis/src/renderers/Form/Select.tsx +++ b/packages/amis/src/renderers/Form/Select.tsx @@ -229,7 +229,7 @@ export default class SelectControl extends React.Component { } focus() { - this.input && this.input?.focus(); + this.input && this.input?.focus?.(); } getValue(