fix: tree node can't expand

This commit is contained in:
duanhongbo committed 2020-12-03 18:50:59 +08:00
1 parent a99ecd2c3c
commit 0d7da8d432
1 file changed
+2
+2
View File
@@ -243,6 +243,7 @@ export default class Explorer extends Component<ExplorerProps> {
shouldComponentUpdate(nextProps: ExplorerProps) { shouldComponentUpdate(nextProps: ExplorerProps) {
const shouldUpdate = this.curWorkdir != nextProps.workdir; const shouldUpdate = this.curWorkdir != nextProps.workdir;
this.curWorkdir = nextProps.workdir; this.curWorkdir = nextProps.workdir;
this.updateRoot();
return shouldUpdate; return shouldUpdate;
} }
@@ -415,6 +416,7 @@ export default class Explorer extends Component<ExplorerProps> {
value={[this.state.selectedKey]} value={[this.state.selectedKey]}
onExpand={(expanded)=>{ onExpand={(expanded)=>{
this.setState({ expandedKeys: expanded }) this.setState({ expandedKeys: expanded })
this.forceUpdate();
}} }}
renderItem={this.renderItem.bind(this)} renderItem={this.renderItem.bind(this)}
onClick={(node: FileDataNode) => { onClick={(node: FileDataNode) => {