import React, { useState } from "react"; import { toast } from "react-toastify"; // 自定义Toast内容组件 const ExpandableToastContent = ({ fullText }) => { const [isExpanded, setIsExpanded] = useState(false); const toggleExpand = () => setIsExpanded(!isExpanded); return (
{/* 可以继续添加更多的Tailwind CSS类来定制外观 */}
{isExpanded ? fullText : `${fullText.substring(0, 100)}...`}
); }; // 使用自定义Toast内容的函数 export const showExpandableToast = (message: string) => { toast(, { position: "top-center", autoClose: 3000, pauseOnHover: true, className: "toastDetail", }); };