我采用了棱角分明的JS和FullCalendar控制的我的要求之一。
我在角JS完整的日历的代码如下: -
<div ui-calendar="uiConfig.calendar" ng-model="eventSources" id="calendar"></div>
$scope.uiConfig = {
calendar: {
editable: true,
header: {
left: 'title',
center: '',
//right: 'today prev,next'
right: 'today next'
},
aspectRatio: 1.25,
selectable: true,
events: $scope.eventsselection,
dayClick: $scope.dayClick,
validRange: function (nowDate) {
return {
start: nowDate.clone().subtract(1, 'days'),
};
}
}
};
我想补充我的自定义业务逻辑,当用户点击右上角“今天”按钮。如何实现这一目标?
您可以定义与文本的CustomButton“今天”
customButtons: {
myTodayButton: {
text: 'Today',
click: function() {
/* Add custom logic here */
$('#calendar').fullCalendar('today'); //will change calendar to today
}
}
},
为了能够看到这个按钮,你必须将它添加到页眉选项而不是今天的选择
header: {
left: 'title',
center: '',
right: 'myTodayButton next'
},