我正在尝试在我的Full Calendar中添加一个从react-icons包中获取的图标作为自定义标题按钮。因为图标是从包中导出的,而不是用作类名,所以我似乎无法呈现该图标或任何图标。我希望你能做这样的事情:
const customButtons = {
custom1: {
icon: <MdWatchLater />,
click: function () {
('clicked the custom button!');
}
}
}
但这会引发错误。但是,这种方法也不起作用(使用字体真棒图标),它只是呈现一个正方形:
const customButtons = {
custom1: {
icon: "fa fa-lock",
click: function () {
('clicked the custom button!');
}
}
}
有没有人试过这个?只要我可以将图标加载为自定义按钮,我不介意采用哪种方法。
更新
发布我的完整日历组件,其中包含自定义按钮道具以供参考:
更新 的代码片段而不是照片:
<CustomCalendar
customButtons={customButtons}
header={{
right: '',
center: '',
left: 'today prev,next custom1'
}} />