|
236 | 236 |
|
237 | 237 | // Reacts to external selected dates
|
238 | 238 | this.$watch('value', function (value) {
|
239 |
| - this.calendar = value; |
240 |
| - }, {deep: true}); |
| 239 | + if (value.hasOwnProperty('dateRange')) { |
| 240 | + this.calendar = value; |
| 241 | + } |
| 242 | + }, {immediate: true, deep: true}); |
241 | 243 |
|
242 | 244 | this.$watch('showCalendar', function (value) {
|
243 | 245 | if (value)
|
|
566 | 568 | this.showCalendar = false;
|
567 | 569 | }
|
568 | 570 | } else if (this.fConfigs.isMultipleDatePicker) {
|
569 |
| - if (this.calendar.selectedDates.find(date => date.date === item.date)) { |
| 571 | + if (this.calendar.hasOwnProperty('selectedDates') && this.calendar.selectedDates.find(date => date.date === item.date)) { |
570 | 572 | let dateIndex = this.calendar.selectedDates.findIndex(date => date.date === item.date);
|
571 | 573 | this.calendar.selectedDates.splice(dateIndex, 1);
|
572 | 574 | } else {
|
573 | 575 | let date = Object.assign({}, this.defaultDateFormat);
|
574 | 576 | date.date = item.date;
|
| 577 | +
|
| 578 | + if(!this.calendar.hasOwnProperty('selectedDates')) { |
| 579 | + this.calendar.selectedDates = []; |
| 580 | + } |
| 581 | +
|
575 | 582 | this.calendar.selectedDates.push(date);
|
576 | 583 | }
|
577 | 584 |
|
|
609 | 616 | if (this.calendar.selectedDate === day.date)
|
610 | 617 | day.isMarked = true;
|
611 | 618 | } else if (vm.fConfigs.isMultipleDatePicker) {
|
612 |
| - if (vm.calendar.selectedDates.find(date => date.date === day.date)) |
| 619 | + if (vm.calendar.hasOwnProperty('selectedDates') && vm.calendar.selectedDates.find(date => date.date === day.date)) |
613 | 620 | day.isMarked = true;
|
614 | 621 | } else {
|
615 | 622 | day.isMouseToLeft = false;
|
|
1052 | 1059 | classes.push('vfc-end-marked');
|
1053 | 1060 | }
|
1054 | 1061 |
|
1055 |
| - if (day.date === this.calendar.selectedDate || this.calendar.selectedDates.find(sDate => sDate.date === day.date)) { |
| 1062 | + if (day.date === this.calendar.selectedDate || (this.calendar.hasOwnProperty('selectedDates') && this.calendar.selectedDates.find(sDate => sDate.date === day.date))) { |
1056 | 1063 | classes.push('vfc-borderd')
|
1057 | 1064 | }
|
1058 | 1065 |
|
|
0 commit comments