修复 Nested-Select 配置 source 问题 (#1570)

* 修复nested-select 配置source问题

* fix
This commit is contained in:
RickCole 2021-02-09 13:51:57 +08:00 committed by GitHub
parent ecd57a32ab
commit aef8544b68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,6 +22,7 @@ import {findDOMNode} from 'react-dom';
import {ResultBox, Spinner} from '../../components';
import xor from 'lodash/xor';
import union from 'lodash/union';
import {isEqual} from 'lodash';
/**
* Nested Select
@ -68,6 +69,14 @@ export default class NestedSelectControl extends React.Component<
this.target = ref;
}
componentDidUpdate(prevProps: NestedSelectProps) {
if (prevProps.options !== this.props.options) {
this.setState({
stack: [this.props.options]
});
}
}
@autobind
handleOutClick(e: React.MouseEvent<any>) {
const {options} = this.props;