This commit is contained in:
hailin 2025-03-25 15:54:11 +08:00
parent 96a80b4928
commit 5aaac35dca
1 changed files with 16 additions and 3 deletions

View File

@ -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 (
<div className="sticky top-0 z-30 bg-white">
<div className="mt-4 mb-1 px-6 lg:px-8 w-11/12 lg:w-2/3 xl:w-3/5 mx-auto">
@ -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("/")) ? (
<img src={data.icon} alt="icon" className="w-12 h-12 object-contain" />
{isImagePath ? (
<img
src={resolvedIconSrc}
alt="icon"
className="w-12 h-12 object-contain"
/>
) : (
data?.icon || "Deploy"
)}