ankurk91 / vue-flatpickr-component

Vue.js component for Flatpickr datetime picker :calendar:
https://ankurk91.github.io/vue-flatpickr-component/
MIT License
968 stars 102 forks source link

on-change pass $event $dateStr $instance and custom properties #263

Closed yogithesymbian closed 2 years ago

yogithesymbian commented 2 years ago

i want make it dynamic return to set data()

@on-change="onStartChange" // how to pass custom properties ?
@on-change="onStartChange($event, $what, $andWhat, 'custom')" // how to pass custom properties ?

the default ...

// i only know about $event, but i dont know how about dateStr and instance
    onStartChange(selectedDates, dateStr, instance, model) {
      console.log('selectedDates', selectedDates)
      console.log('dateStr', dateStr)
      console.log('instance', instance)
      console.log('model', model) // here i would like to custom 
      this.configs.end.minDate = dateStr
     // this[`$model`].end // so i can make it like this line // because i have 4 flat-pickr to custom min date by the config
    },

anyone have best trick ? or should i defined 4 function different on @on-change ? its possible to make it dynamic ( so my code can be clean ) ?

ankurk91 commented 2 years ago

Sorry, github is not your code school