Fix menu key conflict.

This commit is contained in:
Yang Luo 2021-02-13 17:56:15 +08:00
parent 6824d558ca
commit e57590ab70

View File

@ -113,9 +113,9 @@ class App extends Component {
} }
handleRightDropdownClick(e) { handleRightDropdownClick(e) {
if (e.key === '0') { if (e.key === '201') {
this.props.history.push(`/account`); this.props.history.push(`/account`);
} else if (e.key === '1') { } else if (e.key === '202') {
this.logout(); this.logout();
} }
} }
@ -123,11 +123,11 @@ class App extends Component {
renderRightDropdown() { renderRightDropdown() {
const menu = ( const menu = (
<Menu onClick={this.handleRightDropdownClick.bind(this)}> <Menu onClick={this.handleRightDropdownClick.bind(this)}>
<Menu.Item key='0'> <Menu.Item key="201">
<SettingOutlined /> <SettingOutlined />
My Account My Account
</Menu.Item> </Menu.Item>
<Menu.Item key='1'> <Menu.Item key="202">
<LogoutOutlined /> <LogoutOutlined />
Logout Logout
</Menu.Item> </Menu.Item>
@ -135,7 +135,7 @@ class App extends Component {
); );
return ( return (
<Dropdown key="4" overlay={menu} > <Dropdown key="200" overlay={menu} >
<a className="ant-dropdown-link" href="#" style={{float: 'right'}}> <a className="ant-dropdown-link" href="#" style={{float: 'right'}}>
<Avatar style={{ backgroundColor: Setting.getAvatarColor(this.state.account.name), verticalAlign: 'middle' }} size="large"> <Avatar style={{ backgroundColor: Setting.getAvatarColor(this.state.account.name), verticalAlign: 'middle' }} size="large">
{Setting.getShortName(this.state.account.name)} {Setting.getShortName(this.state.account.name)}