- 优化 DictionarySelect defaultValue 优化
This commit is contained in:
parent
e425d22bf7
commit
c3206ec5f4
|
@ -4,11 +4,15 @@ import DictionaryContext from './DictionaryContext';
|
||||||
|
|
||||||
export default class DictionarySelect extends PureComponent {
|
export default class DictionarySelect extends PureComponent {
|
||||||
renderSelect(children) {
|
renderSelect(children) {
|
||||||
// eslint-disable-next-line react/destructuring-assignment
|
|
||||||
// const { initialValue } = this.props['data-__meta'];
|
// const { initialValue } = this.props['data-__meta'];
|
||||||
const propsX = this.props;
|
const propsX = {
|
||||||
if (propsX.defaultValue === 'undefined' || propsX.defaultValue === 'null') {
|
...this.props,
|
||||||
propsX.defaultValue = undefined;
|
};
|
||||||
|
if (propsX.value !== undefined || propsX.value !== null) {
|
||||||
|
propsX.value = `${propsX.value}`;
|
||||||
|
}
|
||||||
|
if (propsX.value === 'undefined' || propsX.value === 'null') {
|
||||||
|
delete propsX.value;
|
||||||
}
|
}
|
||||||
return <Select {...propsX}>{children}</Select>;
|
return <Select {...propsX}>{children}</Select>;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue