javascript - 如何在 JavaScript 完整日历中仅将自定义按钮用于月视图?
问题描述
我在我的 JavaScript 完整日历代码中添加了自定义按钮,但我只想显示这个按钮的月视图。
$(document).ready(function() {
var calendar = $('#calendar').fullCalendar({
editable: true,
//FOR HEADER
header: {
left: ' prev,next today ',
center: 'title',
right: 'month,agendaDay,agendaWeek,myCustomButton'
},
customButtons: {
myCustomButton: {
text: 'REPEAT FOR NEXT MONTH',
click: function() {
alert('my custom button');
}
}
}
});
});
解决方案
如果您需要在月视图中为每一天附加按钮,那么您可以使用以下代码段:-
eventAfterAllRender: function(view) {
if(view.name == 'month')
{
$('.fc-day').each(function(){
$(this).append('<button>Day</button>');
});
}
}
推荐阅读
- angular - Angular 5.2.3 数据绑定到名称中带有连字符的数据属性
- android - 为什么 LiveData 观察者会被新附加的观察者触发两次
- macros - 另一个宏上下文中的 M4 pushdef
- angularjs - 删除菜单中的初始背景颜色第一个 md 按钮
- mysql - Mysql count case with join
- python - 打印模式的 Python 递归函数
- java - 限制 PLAIN_MESSAGE JOptionPane 中输入文本的大小
- java - Spring Security JWT - 400 错误请求:“无效授权”“错误凭据”
- angular - 无法解析“@angular/router/src/utils/collection”
- npm - 是否可以使用 webpack 分别导入捆绑的 webpack 和库?