ManukMinasyan / vue-functional-calendar

Vue.js Functional Calendar | Component/Package
https://vue-functional-calendar.now.sh/
MIT License
473 stars 85 forks source link

markedDates are not reactive #65

Closed wiiikiii closed 4 years ago

wiiikiii commented 4 years ago

as fare as I understood, markedDates should be reactive? all works fine as long as I reload my page.

my code

    <functional-calendar
      v-if="calc_marked_dates.length > 0"
      ref="calendar"
      :is-dark="true"
      :is-date-picker="true"
      :date-format="'dd.mm.yyyy'"
      :xis-date-range="true"
      :marked-dates="calc_marked_dates"
      :day-names="['Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa', 'So']"
      :month-names="[
        'Jänner',
        'Februar',
        'März',
        'April',
        'Mai',
        'Juni',
        'Juli',
        'August',
        'September',
        'Oktober',
        'November',
        'Dezember'
      ]"
      :show-week-numbers="true"
      @choseDay="chose_day"
    ></functional-calendar>

and in my computed

calc_marked_dates() {
   let res = this.timedata.map(td => {
    return { date: td.date, class: "bg-blue-400" }
  })
  return res
},
wiiikiii commented 4 years ago

I am using version "2.8.69"

selvievski commented 4 years ago

Hi, You should update the markdays variable with the set method like this:
Vue.set(this.markedDates, i, { date: date, class: "marked-date" });