【发布时间】:2021-07-16 02:34:49
【问题描述】:
您好,我不知道如何为 Antd Card 的以下操作设置 onclick 功能。有人可以帮我吗?谢谢。
const expand = () =>{
console.log("expand")
}
const IconText = ({ icon, text, cb }) => (
<Space>
<div onClick={e => cb}>
{React.createElement(icon)}
{text}
</div>
</Space>
);
<Card style={{ width: props.width, height: props.height }}
actions={[
<IconText icon={ExpandOutlined} text="Expand" key="list-vertical-star-o" cb={()=>expand}/>,
<IconText icon={MessageOutlined} text="Comments" key="list-vertical-like-o" />,
]}
>
【问题讨论】: