import { Input, Button, Space } from 'antd'; import React, { useState } from 'react'; type InfoCardProps = { onAdd: (content: string) => void; } const InfoCard: React.FC = ({ onAdd }) => { const [content, setContent] = useState(''); const [addedContents, setAddedContents] = useState([]); const handleAdd = () => { if (content) { onAdd(content); setAddedContents([...addedContents, content]); setContent(''); } } return ( // 增大内边距,避免内容被覆盖
setContent(e.target.value)} />
{addedContents.map((item, index) => (
{item}
))}
); } export default InfoCard;