fix: select toValue (#1962)
* fix: select toValue * fix: select toValue
This commit is contained in:
parent
98be397574
commit
ea04d2309e
@ -79,6 +79,12 @@ const InternalSelect = connect(
|
|||||||
if (objectValue) {
|
if (objectValue) {
|
||||||
return <ObjectSelect {...others} value={value} mode={mode} loading={loading} />;
|
return <ObjectSelect {...others} value={value} mode={mode} loading={loading} />;
|
||||||
}
|
}
|
||||||
|
const toValue = (v) => {
|
||||||
|
if (['tags', 'multiple'].includes(props.mode) || props.multiple) {
|
||||||
|
return toArr(v);
|
||||||
|
}
|
||||||
|
return v;
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<AntdSelect
|
<AntdSelect
|
||||||
showSearch
|
showSearch
|
||||||
@ -86,7 +92,7 @@ const InternalSelect = connect(
|
|||||||
allowClear
|
allowClear
|
||||||
dropdownMatchSelectWidth={false}
|
dropdownMatchSelectWidth={false}
|
||||||
notFoundContent={loading ? <Spin /> : <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />}
|
notFoundContent={loading ? <Spin /> : <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />}
|
||||||
value={value?value:undefined}
|
value={toValue(value)}
|
||||||
{...others}
|
{...others}
|
||||||
onChange={(changed) => {
|
onChange={(changed) => {
|
||||||
props.onChange?.(changed === undefined ? null : changed);
|
props.onChange?.(changed === undefined ? null : changed);
|
||||||
|
Loading…
Reference in New Issue
Block a user