little fix

This commit is contained in:
tangly1024.com
2024-01-30 18:45:39 +08:00
parent 16455c04de
commit 69fbde8328
2 changed files with 5 additions and 3 deletions

View File

@@ -20,6 +20,9 @@ export const MenuItem = ({ link }) => {
return null
}
// #号加标题 快速跳转到指定锚点
const url = link?.to && link?.to.length > 0 ? link.to : '#' + link?.title
return <>
{/* 菜单 */}
<div
@@ -36,8 +39,7 @@ export const MenuItem = ({ link }) => {
</div>
</>)
: (
// link?.to
<Link href={'#' + link?.title} className='dark:text-neutral-400 dark:hover:text-white font-bold w-full display-block'>
<Link href={url} className='dark:text-neutral-400 dark:hover:text-white font-bold w-full display-block'>
{link?.icon && <i className={`text-base ${link?.icon}`} />}{link?.title}
</Link>
)