mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-29 16:11:23 +08:00
docs: Rewrite Cascader demos to ES6 component (#4943)
This commit is contained in:
parent
7a4080ec40
commit
0d2da7ad3b
@ -32,17 +32,16 @@ const options = [{
|
||||
}],
|
||||
}];
|
||||
|
||||
const CitySwitcher = React.createClass({
|
||||
getInitialState() {
|
||||
return {
|
||||
text: 'Unselect',
|
||||
};
|
||||
},
|
||||
onChange(value, selectedOptions) {
|
||||
class CitySwitcher extends React.Component {
|
||||
state = {
|
||||
text: 'Unselect',
|
||||
};
|
||||
|
||||
onChange = (value, selectedOptions) => {
|
||||
this.setState({
|
||||
text: selectedOptions.map(o => o.label).join(', '),
|
||||
});
|
||||
},
|
||||
}
|
||||
render() {
|
||||
return (
|
||||
<span>
|
||||
@ -53,8 +52,8 @@ const CitySwitcher = React.createClass({
|
||||
</Cascader>
|
||||
</span>
|
||||
);
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
ReactDOM.render(<CitySwitcher />, mountNode);
|
||||
````
|
||||
|
Loading…
Reference in New Issue
Block a user