전체 일정을 VueJS와 함께 사용하고 있으며 캘린더에서 시간을 클릭 할 때마다 사용자 지정 모달을 열려고합니다. 그러나, 내 모달을 열려면 전체 일정 개체 외부에서 별도의 함수를 호출해야하며 전체 일정 내에 this
을 사용하면 해당 개체와 Vue 구성 요소 개체를 참조하므로 해결 방법을 모르겠습니다. 나는 뷰 구성 요소 객체를 가져 오는 어떻게든지 필요, 여기에 내가 아무 소용이내부에서 Vue 구성 요소 객체에 액세스 구성 요소 내에 생성 된 FullCalendar 객체
export default {
name: 'MyComponent',
methods: {
myFunc() {
// should get called from inside fullCalendar below
this.$store.dispatch() // this.$store works here since `this` refers to Vue component
}
},
mounted() {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay,listWeek'
},
navLinks: true,
eventLimit: true,
defaultView: 'agendaWeek',
editable: true,
selectable: true,
selectHelper: true,
select: function (start, end) {
console.log(this) // refers to Full Calendar object
console.log(this.$parent) // getting null, need to call function in vue component
console.log(this.myFunc()) // cannot do this since this will try to call a function in Full Calendar library
console.log(this.$parent.$store) // getting null, need to get store that I defined
}
}
}
끝내 주셔서 감사합니다! – user3226932