Настроила скролл к текущему времени

This commit is contained in:
Daria Golova
2022-11-10 13:33:03 +03:00
parent f6248a301f
commit 83641ba302
2 changed files with 12420 additions and 29 deletions

12437
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -9,7 +9,7 @@
@next-date="nextDate" @next-date="nextDate"
@selected-layout="selectedLayout" @selected-layout="selectedLayout"
) )
.schedule-body(@scroll="changeScrollingState") .schedule-body(@scroll="changeScrollingState", ref="scheduleBody")
.hiding-container.fixed(v-if="isScrolling") .hiding-container.fixed(v-if="isScrolling")
.column-wrapper.flex.ml-20(:style="columnWrapperWidth") .column-wrapper.flex.ml-20(:style="columnWrapperWidth")
calendar-column( calendar-column(
@@ -320,6 +320,14 @@ export default {
changeScrollingState(e) { changeScrollingState(e) {
this.isScrolling = e.target.scrollTop !== 0; this.isScrolling = e.target.scrollTop !== 0;
}, },
showCuttentTime() {
this.$nextTick(() =>
this.$refs["scheduleBody"].scrollTo({
top: `${this.lineIndicatorLocation.top.slice(0, -2) - 240}`,
behavior: "smooth",
})
);
},
}, },
watch: { watch: {
currentTime() { currentTime() {
@@ -344,6 +352,7 @@ export default {
this.changeCurrentTime(); this.changeCurrentTime();
this.timeCoilInitialization(); this.timeCoilInitialization();
this.startTimer(); this.startTimer();
this.showCuttentTime();
} }
}, },
}, },
@@ -351,6 +360,7 @@ export default {
this.changeCurrentTime(); this.changeCurrentTime();
this.timeCoilInitialization(); this.timeCoilInitialization();
this.startTimer(); this.startTimer();
this.showCuttentTime();
}, },
beforeUnmount() { beforeUnmount() {
this.stopTimer(); this.stopTimer();