--- order: 2 title: zh-CN: 只展开当前父级菜单 en-US: Only to open the current parant menu --- ## zh-CN 点击菜单,收起其他展开的所有菜单,保持菜单聚焦简洁。 ## en-US Click the menu and you will see that all the other menus gets collapsed to keep the entire menu compact. ````jsx import { Menu, Icon } from 'antd'; const SubMenu = Menu.SubMenu; const Sider = React.createClass({ getInitialState() { return { current: '1', openKeys: [], }; }, handleClick(e) { console.log('click ', e); this.setState({ current: e.key, openKeys: e.keyPath.slice(1), }); }, onToggle(info) { this.setState({ openKeys: info.open ? info.keyPath : info.keyPath.slice(1), }); }, render() { return ( 导航一}> 选项1 选项2 选项3 选项4 导航二}> 选项5 选项6 选项7 选项8 导航三}> 选项9 选项10 选项11 选项12 ); }, }); ReactDOM.render(, mountNode); ````