Fix initialization logic
This commit is contained in:
parent
0bed421da3
commit
b1cdb3be87
1 changed files with 4 additions and 3 deletions
|
|
@ -150,7 +150,7 @@ export default {
|
|||
if (!newDates.length) return;
|
||||
|
||||
if (!this.initialized && !this.modelValue) {
|
||||
this.initializeWindow();
|
||||
this.initialize();
|
||||
return;
|
||||
}
|
||||
// Pending auto select is set when the user is at the end of the dates and the next page of dates is loaded.
|
||||
|
|
@ -170,8 +170,9 @@ export default {
|
|||
const index = this.allDates.findIndex((d) => d.value === this.modelValue);
|
||||
if (index !== -1) this.windowStart = this.getWindowStartFromIndex(index);
|
||||
} else {
|
||||
this.initializeWindow();
|
||||
this.initialize();
|
||||
}
|
||||
this.initialized = true;
|
||||
},
|
||||
beforeUnmount() {
|
||||
window.removeEventListener("resize", this.updateWindowSize);
|
||||
|
|
@ -212,7 +213,7 @@ export default {
|
|||
const first = this.visibleDates.find((d) => d.isAvailable);
|
||||
this.$emit("update:modelValue", first ? first.value : null);
|
||||
},
|
||||
initializeWindow() {
|
||||
initialize() {
|
||||
this.initialized = true;
|
||||
if (this.modelValue !== null) return;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue