This commit is contained in:
hailin 2025-03-30 13:57:04 +08:00
parent 328855325f
commit 7141d2992a
1 changed files with 19 additions and 1 deletions

View File

@ -39,6 +39,8 @@ import { LogoAI } from '@/components/chat'
import { useState } from "react";
import { Trash2 } from "lucide-react";
import {
BadgeInfo,
Tags,
@ -163,6 +165,22 @@ export function DetailPageHeader({ data }: { data: any }) {
}
};
// ✅ 删除函数
const handleDelete = () => {
if (loading) return;
const confirmed = window.confirm("确定要删除模型吗?");
if (confirmed) {
setLoading(true);
// 模拟删除流程(实际调用 API 或其他逻辑)
// await deleteComponent(data.id);
console.log("模型已删除");
setLoading(false);
}
};
// 处理图标路径
const isImagePath =
typeof data?.icon === "string" &&
@ -219,7 +237,7 @@ export function DetailPageHeader({ data }: { data: any }) {
{/* 占位 + 删除按钮 */}
<div className="flex-1 flex justify-end items-end">
<button
onClick={() => handleClick("delete")}
onClick={() => handleDelete("delete")}
className="text-red-500 hover:text-red-700 transition"
disabled={loading}
>