[Vuejs]-How to store a value in a variable in a callback function in vuejs

4👍

✅

The problem is your callback function. If you want access to the Vue instance, it has to be an arrow function:

dateSet: (dateInfo) => {
  this.startDate = dateInfo.start
}

Inside your callback, this is not the Vue instance.

2👍

Could you try with:

computed: {
   getDateRange() {
        return this.startDate;
   }
}

Or maybe you did not provide prop value in outer component

Leave a comment