Commit f1252dcf authored by Nekojita1's avatar Nekojita1 Committed by GitHub

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

parent 1ef72a32
...@@ -236,6 +236,11 @@ export default { ...@@ -236,6 +236,11 @@ export default {
this.timer = setInterval(this.playSlides, this.interval); this.timer = setInterval(this.playSlides, this.interval);
}, },
resetTimer() {
this.pauseTimer();
this.startTimer();
},
setActiveItem(index) { setActiveItem(index) {
if (typeof index === 'string') { if (typeof index === 'string') {
const filteredItems = this.items.filter(item => item.name === index); const filteredItems = this.items.filter(item => item.name === index);
...@@ -260,6 +265,7 @@ export default { ...@@ -260,6 +265,7 @@ export default {
if (oldIndex === this.activeIndex) { if (oldIndex === this.activeIndex) {
this.resetItemPosition(oldIndex); this.resetItemPosition(oldIndex);
} }
this.resetTimer();
}, },
prev() { prev() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment