antd 中 Paragraph无收起按钮
// rows 控制超出几行显示省略
// key 保持每一个div的key值 已备diff算法更新
onst [fold, setFold] = useState(false);
const [key, setKey] = useState(0);
// 控制点击展开
const onExpand = () => {
setFold(true)
}
//控制收起
const onCollapse = (e) => {
e.preventDefault();
setFold(false)
setKey(key + 1)
}
<div key={key}>
<Paragraph ellipsis={{ rows, expandable: isShow ? true : false, onExpand: onExpand }}>
{ fold ? <span>{cpntent}<a onClick={onCollapse}>收起</a></span> : cpntent}
</Paragraph>
</div>