|
|
|
@ -114,9 +114,7 @@ VantComponent({ |
|
|
|
scrollIntoView: '', |
|
|
|
}, |
|
|
|
created() { |
|
|
|
this.setData({ |
|
|
|
currentDate: this.getInitialDate(), |
|
|
|
}); |
|
|
|
this.setData({ currentDate: this.getInitialDate() }); |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
if (this.data.show || !this.data.poppable) { |
|
|
|
@ -133,10 +131,7 @@ VantComponent({ |
|
|
|
if (this.contentObserver != null) { |
|
|
|
this.contentObserver.disconnect(); |
|
|
|
} |
|
|
|
const contentObserver = this.createIntersectionObserver({ |
|
|
|
thresholds: [0, 0.1, 0.9, 1], |
|
|
|
observeAll: true, |
|
|
|
}); |
|
|
|
const contentObserver = this.createIntersectionObserver({ thresholds: [0, 0.1, 0.9, 1], observeAll: true }); |
|
|
|
this.contentObserver = contentObserver; |
|
|
|
contentObserver.relativeTo('.van-calendar__body'); |
|
|
|
contentObserver.observe('.month', (res) => { |
|
|
|
@ -264,9 +259,7 @@ VantComponent({ |
|
|
|
}, |
|
|
|
emit(date) { |
|
|
|
const getTime = (date) => (date instanceof Date ? date.getTime() : date); |
|
|
|
this.setData({ |
|
|
|
currentDate: Array.isArray(date) ? date.map(getTime) : getTime(date), |
|
|
|
}); |
|
|
|
this.setData({ currentDate: Array.isArray(date) ? date.map(getTime) : getTime(date) }); |
|
|
|
this.$emit('select', copyDates(date)); |
|
|
|
}, |
|
|
|
checkRange(date) { |
|
|
|
@ -278,10 +271,7 @@ VantComponent({ |
|
|
|
return true; |
|
|
|
}, |
|
|
|
onConfirm() { |
|
|
|
if ( |
|
|
|
this.data.type === 'range' && |
|
|
|
!this.checkRange(this.data.currentDate) |
|
|
|
) { |
|
|
|
if (this.data.type === 'range' && !this.checkRange(this.data.currentDate)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
wx.nextTick(() => { |
|
|
|
|