I have configured fullcalendar in vuejs I have a problem using fullcalendar events. When I try to fire these events dateClick and eventClick It gives me following warning on console:
Event "dateclick" is emitted in component but the handler is registered for "dateClick". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "date-click" instead of "dateClick".
Ive tried switching to date-click as well but no luck.
My Html
<script src="~/Scripts/vue/vue.js"></script>
<link href='https://unpkg.com/@fullcalendar/[email protected]/main.css' rel='stylesheet' />
<link href='https://unpkg.com/@fullcalendar/[email protected]/main.css' rel='stylesheet' />
<link href='https://unpkg.com/@fullcalendar/[email protected]/main.css' rel='stylesheet' />
<script src='https://unpkg.com/@fullcalendar/[email protected]/main.js'></script>
<script src='https://unpkg.com/@fullcalendar/[email protected]/main.js'></script>
<script src='https://unpkg.com/@fullcalendar/[email protected]/main.js'></script>
<script src='https://unpkg.com/@fullcalendar/[email protected]/main.js'></script>
<script src="https://unpkg.com/@fullcalendar/[email protected]/main.umd.js"></script>
<div id="app-el">
<full-calendar class="app-calendar"
default-view="dayGridMonth"
ref="fullCalendar"
:header="{
left: 'prev,next today',
center: 'title',
right: 'dayGridMonth,timeGridWeek,timeGridDay,listWeek'
}"
:plugins="plugins"
:weekends="true"
:events="events"
@@eventClick="eventClick"
@@dateClick="handleDateClick" />
</div>
My Js file:
var fullcalendar = Vue.component('FullCalendar', window['FullCalendarVue'].default);
document.addEventListener('DOMContentLoaded', function () {
new Vue({
el: '#app-el',
components: {
fullcalendar: fullcalendar
},
data: function () {
return {
showModal: false,
plugins: [
window.FullCalendarDayGrid.default,
window.FullCalendarTimeGrid.default,
window.FullCalendarInteraction.default,
],
events: [
]
}
},
methods: {
eventClick(args) {
// this.$emit("event-click", this);
this.showModal = true;
},
handleDateClick(arg) {
console.log('handleDateClick');
}
}
});
});
You can use:
@@date-click="handleDateClick" instead of @@dateClick="handleDateClick"
, if that doesn't work you can refer to the discussion on: Github issueyou can try this solution:
For further reference, you can view: Prop Casing (camelCase vs kebab-case)