fix(amis-core): 修复select组件中一个未判空导致的渲染错误

This commit is contained in:
wibetter 2023-05-19 17:37:34 +08:00
parent 86eb7ee4b5
commit beea53c83d

View File

@ -52,14 +52,12 @@ export function normalizeOptions(
return option;
});
} else if (Array.isArray(options as Options)) {
return (options as Options).map(item => {
return (options as Options)
.filter(item => item !== null && item !== undefined)
.map(item => {
const value = item && item[valueField];
/**
* value null null !== undefined
* item中读取属性数据
*/
const idx =
value !== undefined && !item?.children
value !== undefined && !item.children
? share.values.indexOf(value)
: -1;
@ -73,7 +71,11 @@ export function normalizeOptions(
};
if (typeof option.children !== 'undefined') {
option.children = normalizeOptions(option.children, share, valueField);
option.children = normalizeOptions(
option.children,
share,
valueField
);
} else if (value !== undefined) {
share.values.push(value);
share.options.push(option);