Vue2-datepicker: How can i intercept payload from the Select event

Created on 17 Apr 2020  路  3Comments  路  Source: mengxiong10/vue2-datepicker

Hi,
I need to receive date from select. Now it works that select push data into DatePicker, but i need to receive this data straight in my app.
I see that the event is emitted whenever a field is selected. The question is how could I get this payload? Because i want to output picked date(year,month,day) step by step.
Select-year and select-month were great solutions, but they were removed.

@calendar-change does not help me, because it also works after pressing the arrow.

you are doing a good job, thanks

image

Most helpful comment

v3.5.0 added it.

All 3 comments

I think I can add an argument for calendar-change.
type: 'year' | 'month' | 'last-year' | 'next-year' | 'last-month' | 'next-month' | 'last-decade' | 'next-decade'

<date-picker  @calendar-change="handleCalendarChange" />

handleCalendarChange(value, oldValue, type) {
 if (type === 'year') { // when select year }
 if (type === 'month') { // when select month }
}

this solution would be very helpful, thank you

v3.5.0 added it.

Was this page helpful?
0 / 5 - 0 ratings