File tree 1 file changed +22
-2
lines changed 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -290,14 +290,34 @@ export default {
290
290
changeCalendarMonth (month ) {
291
291
this .now = new Date (this .calendarYear , month)
292
292
},
293
+ getSibling () {
294
+ const calendars = this .$parent .$children .filter (v => v .$options .name === this .$options .name )
295
+ const index = calendars .indexOf (this )
296
+ const sibling = calendars[index ^ 1 ]
297
+ return sibling
298
+ },
293
299
handleIconMonth (flag ) {
294
- this .changeCalendarMonth (this .calendarMonth + flag)
300
+ const month = this .calendarMonth
301
+ this .changeCalendarMonth (month + flag)
302
+ this .$parent .$emit (' change-calendar-month' , {
303
+ month,
304
+ flag,
305
+ vm: this ,
306
+ sibling: this .getSibling ()
307
+ })
295
308
},
296
309
handleIconYear (flag ) {
297
310
if (this .panel === ' YEAR' ) {
298
311
this .changePanelYears (flag)
299
312
} else {
300
- this .changeCalendarYear (this .calendarYear + flag)
313
+ const year = this .calendarYear
314
+ this .changeCalendarYear (year + flag)
315
+ this .$parent .$emit (' change-calendar-year' , {
316
+ year,
317
+ flag,
318
+ vm: this ,
319
+ sibling: this .getSibling ()
320
+ })
301
321
}
302
322
},
303
323
handleBtnYear () {
You can’t perform that action at this time.
0 commit comments