/* eslint no-console:0 */ import React from 'react'; import ReactDOM from 'react-dom'; import Menu, { SubMenu, Item as MenuItem, Divider } from 'rc-menu'; import 'rc-menu/assets/index.less'; import animate from 'css-animation'; function handleClick(info) { console.log(`clicked ${info.key}`); console.log(info); } const animation = { enter(node, done) { let height; return animate(node, 'rc-menu-collapse', { start() { height = node.offsetHeight; node.style.height = 0; }, active() { node.style.height = `${height}px`; }, end() { node.style.height = ''; done(); }, }); }, appear() { return this.enter.apply(this, arguments); }, leave(node, done) { return animate(node, 'rc-menu-collapse', { start() { node.style.height = `${node.offsetHeight}px`; }, active() { node.style.height = 0; }, end() { node.style.height = ''; done(); }, }); }, }; const reactContainer = document.getElementById('__react-content'); const nestSubMenu = (offset sub menu 2} key="4" popupOffset={[10, 15]}> inner inner sub menu 3} > inner inner inner inner2 inn sub menu 4} key="4-2-2"> inner inner inner inner2 inner inner inner inner2 ); function onOpenChange(value) { console.log('onOpenChange', value); } const commonMenu = ( sub menu} key="1"> 0-1 0-2 {nestSubMenu} 1 outer disabled outer3 ); function render(container) { const horizontalMenu = React.cloneElement(commonMenu, { mode: 'horizontal', // use openTransition for antd openAnimation: 'slide-up', }); const horizontalMenu2 = React.cloneElement(commonMenu, { mode: 'horizontal', openAnimation: 'slide-up', triggerSubMenuAction: 'click', }); const verticalMenu = React.cloneElement(commonMenu, { mode: 'vertical', openAnimation: 'zoom', }); const inlineMenu = React.cloneElement(commonMenu, { mode: 'inline', defaultOpenKeys: ['1'], openAnimation: animation, }); ReactDOM.render(

antd menu

horizontal

{horizontalMenu}

horizontal and click

{horizontalMenu2}

vertical

{verticalMenu}

inline

{inlineMenu}
, container); } render(reactContainer);