补充容错 (#2059)

This commit is contained in:
liaoxuezhi 2021-06-04 19:25:16 +08:00 committed by GitHub
parent d1a4cad499
commit df1a4bb54b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 1 deletions

View File

@ -124,6 +124,11 @@ export function renderChild(
}
const typeofnode = typeof node;
if (typeofnode === 'undefined' || node === null) {
return null;
}
let schema: Schema =
typeofnode === 'string' || typeofnode === 'number'
? {type: 'tpl', tpl: String(node)}

View File

@ -489,7 +489,7 @@ addSchemaFilter(function (schema: Schema, renderer: any, props: any) {
return schema;
function controlToNormalRenderer(item: any) {
if (item.$ref && props.resolveDefinitions) {
if (item?.$ref && props.resolveDefinitions) {
item = {
...props.resolveDefinitions(item.$ref),
...item

View File

@ -811,6 +811,10 @@ export default class Form extends React.Component<FormProps, object> {
) {
const {store, formLazyChange} = this.props;
if (typeof name !== 'string') {
return;
}
store.changeValue(name, value, changePristine);
(formLazyChange === false ? this.emitChange : this.lazyEmitChange)(submit);