reactjs - Ant Design React 中的回调按钮单击事件
问题描述
我正在做一个使用 AntDesign 的项目。布局有一个默认的标题样式,带有在道具中设置的图标:
const Header = () => {
const headerProps = {
title: "VIEWER",
iconsBefore: [
{ icon: { set: "antd", type: "Layers" } },
{ icon: { set: "antd", type: "close" } },
],
iconsAfter: [
{ icon: { set: "antd", type: "Levels" } },
{ icon: { set: "antd", type: "share-alt" } },
],
};
return (
<Layout>
// Props are passed into the header bar here
<Layout.Header {....headerProps}>
<Button type={`close`} closeFunction={closeFunction} />
</Layout.Header>
</Layout>
);
};
export default Topbar;
这是我以前没有使用过的模式,可能不正确,所以我对这个模式有疑问。如何在 props 中调用指定图标的 onClick 事件。
解决方案
推荐阅读
- javascript - 使用 Vue.js 2 在 HTML 中打印图标 + 变量 + 字符串
- c# - 从单选按钮组 asp.net mvc 读取数据
- javascript - 尝试这样做,以便如果年份值介于 2 个值之间,您将被分配一个特定的标题
- arrays - 当我返回应用程序时,nsuserdefaults 数据正在被重置/清除
- flutter - 颤振图像未显示
- reactjs - 使用 React.js 和 Ant Design 的动态选项卡
- tensorflow - 归一化 Keras 二元和分类交叉熵损失值
- python - 我们可以用前导下划线命名python函数(不是方法!)吗?
- python - Python Flask CORS - 请求的资源上不存在“Access-Control-Allow-Origin”标头
- paypal - 与 PayPal 连接停止工作并给出错误:版本+信息+is+unavailable+for+key+aac_jws_keypair 后未进行任何更改