We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ef375a3 commit 1c4e103Copy full SHA for 1c4e103
src/components/SiderCustom.jsx
@@ -15,16 +15,20 @@ class SiderCustom extends Component {
15
selectedKey: ''
16
};
17
componentDidMount() {
18
- const _path = this.props.path;
19
- this.setState({
20
- openKey: _path.substr(0, _path.lastIndexOf('/')),
21
- selectedKey: _path
22
- });
+ this.setMenuOpen(this.props);
23
}
24
componentWillReceiveProps(nextProps) {
25
console.log(nextProps);
26
this.onCollapse(nextProps.collapsed);
+ this.setMenuOpen(nextProps)
27
+ setMenuOpen = props => {
+ const {path} = props;
+ this.setState({
28
+ openKey: path.substr(0, path.lastIndexOf('/')),
29
+ selectedKey: path
30
+ });
31
+ };
32
onCollapse = (collapsed) => {
33
console.log(collapsed);
34
this.setState({
0 commit comments