import { Button, Form, Input, message } from "antd"; import { useEffect } from "react"; import { mRequest } from "@/app/_lib/request"; export default function EditIconContent({ item, onRefresh, }: { item: | null; onRefresh: () => void; }) { const [form] = Form.useForm(); console.log(item); useEffect(() => { if (item) { form.setFieldsValue({ ...item }); } else { form.resetFields(); } }, [item, form]); return (
{ console.log(res); mRequest(item ? "PUT" : "POST", "/app/linkIcon", { data: item ? { id: item.id, ...res } : res, returnType: "text", }).then(() => { message.success((item ? "修改" : "新增") + "成功"); onRefresh(); }); }} > { !item ? <> : '' }
); }