File tree 2 files changed +19
-5
lines changed
2 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,9 @@ export default {
49
49
type : Boolean ,
50
50
default : undefined ,
51
51
} ,
52
+ getYearPanel : {
53
+ type : Function ,
54
+ } ,
52
55
titleFormat : {
53
56
type : String ,
54
57
default : 'YYYY-MM-DD' ,
@@ -226,6 +229,7 @@ export default {
226
229
< TableYear
227
230
calendar = { innerCalendar }
228
231
getCellClasses = { this . getYearClasses }
232
+ getYearPanel = { this . getYearPanel }
229
233
onSelect = { this . handleSelectYear }
230
234
onChangecalendar = { this . handleCalendarChange }
231
235
/>
Original file line number Diff line number Diff line change @@ -49,15 +49,17 @@ export default {
49
49
type: Function ,
50
50
default : () => [],
51
51
},
52
+ getYearPanel: {
53
+ type: Function ,
54
+ },
52
55
},
53
56
computed: {
54
57
years () {
55
- const firstYear = Math .floor (this .calendar .getFullYear () / 10 ) * 10 ;
56
- const years = [];
57
- for (let i = 0 ; i < 10 ; i++ ) {
58
- years .push (firstYear + i);
58
+ const calendar = new Date (this .calendar );
59
+ if (typeof this .getYearPanel === ' function' ) {
60
+ return this .getYearPanel (calendar);
59
61
}
60
- return chunk (years, 2 );
62
+ return this . getYears (calendar );
61
63
},
62
64
firstYear () {
63
65
return this .years [0 ][0 ];
@@ -68,6 +70,14 @@ export default {
68
70
},
69
71
},
70
72
methods: {
73
+ getYears (calendar ) {
74
+ const firstYear = Math .floor (calendar .getFullYear () / 10 ) * 10 ;
75
+ const years = [];
76
+ for (let i = 0 ; i < 10 ; i++ ) {
77
+ years .push (firstYear + i);
78
+ }
79
+ return chunk (years, 2 );
80
+ },
71
81
getNextCalendar (diffYear ) {
72
82
const year = this .calendar .getFullYear ();
73
83
const month = this .calendar .getMonth ();
You can’t perform that action at this time.
0 commit comments