From 51e8edcea91d4d216f8763d3ce1ca1e40751f6e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E9=98=B3?= Date: Thu, 11 Sep 2025 17:17:05 +0800 Subject: [PATCH] =?UTF-8?q?refactor(Header):=20=E4=BC=98=E5=8C=96=E5=AF=BC?= =?UTF-8?q?=E8=88=AA=E7=BB=84=E4=BB=B6=E6=B8=B2=E6=9F=93=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将分类和导航项的渲染结构进行调整,使用div包裹每个列表项 - 统一子导航项的渲染逻辑,确保代码结构更清晰 - 修复部分列表项的key属性,提升渲染性能 --- src/components/Header/component/AAA/index.tsx | 65 +++++++++++++------ src/components/Header/index.tsx | 10 +-- 2 files changed, 51 insertions(+), 24 deletions(-) diff --git a/src/components/Header/component/AAA/index.tsx b/src/components/Header/component/AAA/index.tsx index 5da20f4..572bb06 100755 --- a/src/components/Header/component/AAA/index.tsx +++ b/src/components/Header/component/AAA/index.tsx @@ -19,26 +19,53 @@ export default ({ list, open, onClose }: Props) => { diff --git a/src/components/Header/index.tsx b/src/components/Header/index.tsx index ca2bc51..f135cd7 100755 --- a/src/components/Header/index.tsx +++ b/src/components/Header/index.tsx @@ -21,7 +21,7 @@ import { Other, Theme, Web } from '@/types/app/config'; const Header = () => { const patchName = usePathname(); - + // 是否暗黑模式 const { isDark, setIsDark, setWeb, theme, setTheme, setOther } = useConfigStore(); @@ -111,10 +111,10 @@ const Header = () => { {/* 文章分类 */} {cateList?.map((one) => ( - <> +
{/* 渲染分类 */} {one.type === 'cate' && ( -
  • +
  • {one.icon} {one.name} @@ -138,7 +138,7 @@ const Header = () => { {/* 渲染导航 */} {one.type === 'nav' && ( -
  • +
  • {one.icon} {one.name} {/* 如果有子分类就显示下拉三角 */} @@ -160,7 +160,7 @@ const Header = () => {
  • )} - +
    ))}