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 duration-500 justify-between text-gray-500 dark:text-gray-300 hover:text-black hover:underline cursor-pointer 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}
    • })}
    }
  • }