【发布时间】:2019-03-28 06:20:27
【问题描述】:
我正在使用没有 jquery 的 fullCalendar v4.0。我已经这样初始化了
<div id="calendar"></div>
在数据对象中我有这个。
calendar: null,
config: {
plugins: [ interactionPlugin, dayGridPlugin, timeGridPlugin, listPlugin, momentPlugin],
axisFormat: 'HH',
defaultView: 'timeGridWeek',
allDaySlot: false,
slotDuration: '00:60:00',
columnFormat: 'dddd',
titleFormat: 'dddd, MMMM D, YYYY',
defaultDate: '1970-01-01',
dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
eventLimit: true,
eventOverlap: false,
eventColor: '#458CC7',
firstDay: 1,
height: 'auto',
selectHelper: true,
selectable: true,
timezone: 'local',
header: {
left: '',
center: '',
right: '',
},
select: (event) => {
this.selectCalendar(event)
},
header: false,
events: null
}
}
虽然在数据变量中有一个日历,但现在我可以从任何地方render() 和destroy() 它。
但我在处理日历事件时遇到问题:
如
select: (event) => {
this.selectCalendar(event)
}
我在methods: {} 中定义了另一个方法selectCalendar() 在选择中调用它,但我收到一个错误
Uncaught TypeError: Cannot read property 'selectCalendar' of undefined
我想对select、eventClick、eventDrop、eventResize 做一些操作,但我无法在配置中调用方法。
还有什么方法可以将 select 或任何方法定义为
select: this.selectCalendar
所以它会直接向定义的方法发送事件?
我已经尝试过 vue-fullcalendar,但它对我的事业不起作用。任何帮助将不胜感激。
Vue v.2.5.21
【问题讨论】:
标签: vue.js vuejs2 fullcalendar fullcalendar-4