mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-06 16:06:28 +08:00
docs: Remove useless code
This commit is contained in:
parent
5818fdb1a2
commit
8d1ed2822b
@ -73,40 +73,5 @@ const Demo: React.FC<{}> = () => {
|
||||
return <Tree loadData={onLoadData} treeData={treeData} />;
|
||||
};
|
||||
|
||||
class Demo1 extends React.Component {
|
||||
state = {
|
||||
treeData: [
|
||||
{ title: 'Expand to load', key: '0' },
|
||||
{ title: 'Expand to load', key: '1' },
|
||||
{ title: 'Tree Node', key: '2', isLeaf: true },
|
||||
],
|
||||
};
|
||||
|
||||
onLoadData = treeNode => {
|
||||
const { treeData } = this.state;
|
||||
return new Promise(resolve => {
|
||||
const { props } = treeNode;
|
||||
if (treeNode.children) {
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
setTimeout(() => {
|
||||
treeNode.children = [
|
||||
{ title: 'Child Node', key: `${treeNode.eventKey}-0` },
|
||||
{ title: 'Child Node', key: `${treeNode.eventKey}-1` },
|
||||
];
|
||||
this.setState({
|
||||
treeData: [...this.state.treeData],
|
||||
});
|
||||
resolve();
|
||||
}, 1000);
|
||||
});
|
||||
};
|
||||
|
||||
render() {
|
||||
return <Tree loadData={this.onLoadData} treeData={this.state.treeData} />;
|
||||
}
|
||||
}
|
||||
|
||||
ReactDOM.render(<Demo />, mountNode);
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user