有个可能 valueField 没值

This commit is contained in:
2betop 2022-04-13 14:52:50 +08:00
parent 90df914d43
commit 211d2bda78

View File

@ -114,7 +114,7 @@ export function value2array(
return value
.map((value: any) =>
expandValue(value, props.options, props.valueField) ||
(isObject(value) && value.hasOwnProperty(props.valueField))
(isObject(value) && value.hasOwnProperty(props.valueField || 'value'))
? value
: undefined
)
@ -130,7 +130,8 @@ export function value2array(
);
return expandedValue
? [expandedValue]
: isObject(value) && (value as Option).hasOwnProperty(props.valueField)
: isObject(value) &&
(value as Option).hasOwnProperty(props.valueField || 'value')
? [value as Option]
: [];
}