edisdev/vue-datepicker-ui

Suggestion: close on select

stefandevo opened this issue · 5 comments

How about an option to close the popup when selecting a date?

Currently you can fake it, but i hope the author will implement options for an easier usage.

<calendar
  v-model="calendar.value"
  ...
  v-on:input="calendarChange"
  inputClass="calendar-input"
></calendar>
  data() {
    return {
      calendar: {
        'value': new Date()
      },
      calendarFirstCall: true
    }
  },

  methods: {
    calendarChange: function() {
      // not show the calendar on the first view
      if (this.calendarFirstCall) {
        this.calendarFirstCall = false
        return
      }
      let evt = new MouseEvent('click', {
        bubbles: true,
        cancelable: true,
        view: window
      })
      let elements = document.getElementsByClassName('calendar-input')
      elements[0].dispatchEvent(evt)
    }
  }

Currently you can fake it, but i hope the author will implement options for an easier usage.

Thank you 👍II will make this property with together new feature at near time.

Did near time close? :) its a year and half :)

Sorry, This problem has been resolved albeit late .
Thanks 🙏

Fixed commit: 4cd2c7f