@@ -307,8 +307,19 @@ function splitEvent(props, event) {
307307 return result
308308}
309309
310+ export const computedSelectDay = ( { state } ) =>
311+ ( day ) => {
312+ if ( ! day || ! day . value || day . disabled ) return false
313+
314+ if ( state . multiSelect ) {
315+ return state . selectedDates . includes ( day . value )
316+ } else {
317+ return state . selectedDate === day . value
318+ }
319+ }
320+
310321export const selectDay =
311- ( { state, emit } ) =>
322+ ( { props , state, emit, api } ) =>
312323 ( day , i ) => {
313324 if ( ! day || ! day . value || day . disabled ) return
314325
@@ -323,9 +334,11 @@ export const selectDay =
323334 state . selectedDates . push ( date )
324335 }
325336
337+ const dateEvent = dealEvents ( props , api , state . selectedDates )
338+
326339 emit ( 'update:modelValue' , state . selectedDates )
327340 emit ( 'selected-date-change' , state . selectedDates )
328- emit ( 'date-click' , date )
341+ emit ( 'date-click' , state . selectedDates , dateEvent )
329342 } else {
330343 if ( day . isNext ) {
331344 const { year, month } = nextMonth ( state . activeYear , state . activeMonth )
@@ -342,12 +355,26 @@ export const selectDay =
342355 state . selectedDate =
343356 day . value . toString ( ) . length > 2 ? day . value : `${ state . activeYear } -${ state . activeMonth } -${ day . value } `
344357 state . showSelectedDateEvents = true
358+
359+ const dateEvent = dealEvents ( props , api , [ state . selectedDate ] )
345360
346361 emit ( 'update:modelValue' , state . selectedDate )
347- emit ( 'date-click' , state . selectedDate )
362+ emit ( 'date-click' , state . selectedDate , dateEvent [ 0 ] )
348363 }
349364 }
350365
366+ const dealEvents = ( props , api , date ) => {
367+ return date . map ( item => {
368+ let event = api . getEventByTime ( item , props . _constants . DAY_START_TIME , props . _constants . DAY_END_TIME )
369+ event . forEach ( e => {
370+ delete e . dayArr ;
371+ delete e . dayNumber ;
372+ } ) ;
373+ return event
374+ } )
375+
376+ }
377+
351378export const getEventByMonth =
352379 ( { state } ) =>
353380 ( year , month ) => {
0 commit comments