docs: Rewrite TreeSelect demos to ES6 component

pull/4943/head
bang 8 years ago
parent eabe261648
commit c10b051a92

@ -17,16 +17,14 @@ The most basic usage.
import { TreeSelect } from 'antd';
const TreeNode = TreeSelect.TreeNode;
const Demo = React.createClass({
getInitialState() {
return {
class Demo extends React.Component {
state = {
value: undefined,
};
},
onChange(value) {
}
onChange = (value) => {
console.log(arguments);
this.setState({ value });
},
}
render() {
return (
<TreeSelect
@ -50,8 +48,8 @@ const Demo = React.createClass({
</TreeNode>
</TreeSelect>
);
},
});
}
}
ReactDOM.render(<Demo />, mountNode);
````

@ -45,16 +45,14 @@ const treeData = [{
}],
}];
const Demo = React.createClass({
getInitialState() {
return {
class Demo extends React.Component {
state = {
value: ['0-0-0'],
};
},
onChange(value) {
}
onChange = (value) => {
console.log('onChange ', value, arguments);
this.setState({ value });
},
}
render() {
const tProps = {
treeData,
@ -69,8 +67,8 @@ const Demo = React.createClass({
},
};
return <TreeSelect {...tProps} />;
},
});
}
}
ReactDOM.render(<Demo />, mountNode);
````

@ -36,16 +36,14 @@ const treeData = [{
key: '0-1',
}];
const Demo = React.createClass({
getInitialState() {
return {
class Demo extends React.Component {
state = {
value: undefined,
};
},
onChange(value) {
}
onChange = (value) => {
console.log(arguments);
this.setState({ value });
},
}
render() {
return (
<TreeSelect
@ -58,8 +56,8 @@ const Demo = React.createClass({
onChange={this.onChange}
/>
);
},
});
}
}
ReactDOM.render(<Demo />, mountNode);
````

Loading…
Cancel
Save