import Link from 'next/link' import { useState } from 'react' export const MenuItemDrop = ({ link }) => { const [show, changeShow] = useState(false) const hasSubMenu = link?.subMenus?.length > 0 return
  • changeShow(true)} onMouseOut={() => changeShow(false)} className='relative py-1.5 px-5 duration-300 text-base justify-between hover:bg-gray-700 hover:text-white hover:shadow-lg cursor-pointer font-light flex flex-nowrap items-center '> {!hasSubMenu &&
    {link.name}
    {link.slot} } {hasSubMenu &&
    {link.name}
    {link.slot} {hasSubMenu &&
    }
    } {/* 子菜单 */} {hasSubMenu &&
      {link?.subMenus?.map(sLink => { return
    • {sLink.icon && }
      {sLink.name}
      {sLink.slot}
    • })}
    }
  • }