vue-bulma / datepicker

Datepicker Component for Vue Bulma
MIT License
115 stars 56 forks source link

onChange event for range picker doesn't work consistently #60

Open thomhos opened 7 years ago

thomhos commented 7 years ago

Expected Behavior

When passing { onChange: onChangeHandler } as config options, I expect the onChange to be called everytime something changes.

Actual Behavior

The onChange is called when the datepicker is made visible using v-if. Changes to the actual date range selected do not trigger an onChange.

Steps to Reproduce the Problem

  1. Create a datepicker with range config and onChange callback
  2. Hide it using v-if
  3. Show it, and then try to select a date
  4. The onChange is only triggered when the v-if is applied, not when the date is selected

Specifications

Implementation

<div class="field has-addons" v-if="customRange">
    <div class="control control--datepicker has-icons-right">
         <datepicker placeholder="Select a range" :config="{ mode: 'range', maxDate: 'today', onChange: setCustomRangeDates }"></datepicker>
              <span class="icon is-small is-right">
                <i class="fa fa-calendar"></i>
              </span>
            </div>
            <div class="control">
              <button class="button is-info" @click="submitCustomRange">
                Search
              </button>
            </div>
          </div>
goreau commented 10 months ago

Same behavior using two controls on same page. Only the first one selected fires the correspondent onChange. To reproduce, just insert two controls on same page