Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

258
Views
'Cannot read properties of undefined events' Vue.JS
  <FullCalendar id="calendar"
  :options="calendarOptions"
  />
</section>

export default {
  components: {
    FullCalendar
  },
  
  
  data() {
    return {
      calendarOptions: {
        plugins: [dayGridPlugin ,interactionPlugin, timeGridPlugin, listPlugin],

  methods:{
    newEvent(){
      var theCalendar = document.getElementById("calendar");
      var eventName = document.getElementById("Ename").value;
      var sDate = document.getElementById("startDate").value;
      var eDate = document.getElementById("endDate").value;
      var type = document.getElementById("bookingType").value;
      var number = document.getElementById("numberOfPeople").value;
      
      //The addEvent can't be accessed, currently this function doesn't have access to the object Fullcalendar and because of that
      //we can't use addEvent.
        theCalendar.addEvent({
        title: eventName,
        start: sDate,
        allDay: true
      });
      alert('Great. Now, update your database...');

    }
  }

Hello, my vue.JS code at the moment cant read undefined properties. I want to be able to populate the addEvent class with my calendar properties.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

if you are trying to access the API

you should provide a ref on your calendar

<FullCalendar ref="fullCalendar" :options="calendarOptions" />

which can then be accessed as so

let calendarApi = this.$refs.fullCalendar.getApi()
calendarApi.next()

see here

however i suspect that you actually want is to access the calendarOptions object which is as simple as

this.calendarOptions.events

assuming you have defined the object as specified on the previous link

data() {
  return {
    calendarOptions: {
      plugins: [ dayGridPlugin, interactionPlugin ],
      events: [
        { title: 'event 1', date: '2019-04-01' },
        { title: 'event 2', date: '2019-04-02' }
      ]
    }
  }
},
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!