[Vuejs]-Cannot figure out how to assign a callbacks return value into another property (Vue.js)

0👍

From this example

import { Calendar } from '@fullcalendar/core';
import interactionPlugin from '@fullcalendar/interaction';

You need to use methods

    // you define a method inside your Vue instance
    export default {
     components: {
      FullCalendar,
      Banner,
    },
    data() {
      return {
        ...
        arrivalDate: '',
        calendar: null,
      };
    },
    methods: {
      dateClick(info) {
        this.arrivalDate = info.dateStr;
      },
    },
    created() {
      const self = this;
      this.calendar = new Calendar(calendarEl, {
        plugins: [ interactionPlugin ],
        dateClick: function(info) {
         self.dateClick(info);
         // or self.arrivalDate = info.dateStr;
        }
      });
}

Then you pass the method to your component

<VCalendar @dateClick="dateClick" ...>

Leave a comment