diff --git a/apps/blogai/components/header.tsx b/apps/blogai/components/header.tsx index b688329..f87c992 100644 --- a/apps/blogai/components/header.tsx +++ b/apps/blogai/components/header.tsx @@ -140,6 +140,16 @@ export function DetailPageHeader({ data }: { data: any }) { } }; + // 处理图标路径 + const isImagePath = + typeof data?.icon === "string" && + (data.icon.startsWith("http") || data.icon.startsWith("/")); + + const resolvedIconSrc = + isImagePath && !data.icon.startsWith("http") + ? process.env.NEXT_PUBLIC_CLIENT_IMAGE_URL + data.icon + : data.icon; + return (
@@ -150,9 +160,12 @@ export function DetailPageHeader({ data }: { data: any }) { onClick={() => handleClick("icon")} disabled={loading} > - {typeof data?.icon === "string" && - (data.icon.startsWith("http") || data.icon.startsWith("/")) ? ( - icon + {isImagePath ? ( + icon ) : ( data?.icon || "Deploy" )}