Carousel: reset the timer when setActiveItem method is called (#20846)

This commit is contained in:
Nekojita1
2021-07-28 15:05:24 +08:00
committed by GitHub
parent 1ef72a3283
commit f1252dcf61

View File

@@ -236,6 +236,11 @@ export default {
this.timer = setInterval(this.playSlides, this.interval);
},
resetTimer() {
this.pauseTimer();
this.startTimer();
},
setActiveItem(index) {
if (typeof index === 'string') {
const filteredItems = this.items.filter(item => item.name === index);
@@ -260,6 +265,7 @@ export default {
if (oldIndex === this.activeIndex) {
this.resetItemPosition(oldIndex);
}
this.resetTimer();
},
prev() {