docs: rewrite Dropdown demos to ES6 component (#4946)

pull/4948/head
feng zhi hao 8 years ago committed by GitHub
parent 1c2c93fa81
commit e85c8a25f6

@ -16,20 +16,18 @@ The default is to close the menu when you click on menu items, this feature can
````jsx
import { Menu, Dropdown, Icon } from 'antd';
const OverlayVisible = React.createClass({
getInitialState() {
return {
visible: false,
};
},
handleMenuClick(e) {
class OverlayVisible extends React.Component {
state = {
visible: false,
};
handleMenuClick = (e) => {
if (e.key === '3') {
this.setState({ visible: false });
}
},
handleVisibleChange(flag) {
}
handleVisibleChange = (flag) => {
this.setState({ visible: flag });
},
}
render() {
const menu = (
<Menu onClick={this.handleMenuClick}>
@ -48,8 +46,8 @@ const OverlayVisible = React.createClass({
</a>
</Dropdown>
);
},
});
}
}
ReactDOM.render(<OverlayVisible />, mountNode);
````

Loading…
Cancel
Save