我正在尝试使用来自 Material UI的 React、 react-share和SpeedDial 制作社交分享按钮的 SpeedDial ,但 react-share 要求我使用它的按钮。
我有以下快速拨号代码:
const actions = [
{icon: <FacebookIcon size={32} round />, name: 'Facebook'},
{icon: <TwitterIcon size={32} round />, name: 'Twitter'},
{icon: <WhatsappIcon size={32} round />, name: 'WhatsApp'},
{icon: <TelegramIcon size={32} round />, name: 'Telegram'},
{icon: <EmailIcon size={32} round />, name: 'E-mail'}
];
<SpeedDial
ariaLabel="SpeedDial example"
className={classes.shareButton}
icon={<SpeedDialIcon icon={<ShareIcon/>} openIcon={<CloseIcon/>}/>}
onClose={handleClose}
onOpen={handleOpen}
open={open}
direction='up'
>
{actions.map((action) => (
<SpeedDialAction
key={action.name}
icon={action.icon}
tooltipTitle={action.name}
onClick={action.onClick}
/>
))}
</SpeedDial>
我不知道如何从action.onClick
. 可能吗?