提交 0d2da7ad 编写于 作者: F feng zhi hao 提交者: GitHub

docs: Rewrite Cascader demos to ES6 component (#4943)

上级 7a4080ec
......@@ -32,17 +32,16 @@ const options = [{
}],
}];
const CitySwitcher = React.createClass({
getInitialState() {
return {
class CitySwitcher extends React.Component {
state = {
text: 'Unselect',
};
},
onChange(value, selectedOptions) {
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);
````
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册