mirror of
https://github.com/ElemeFE/element.git
synced 2025-12-13 11:34:02 +08:00
Carousel: reset the timer when setActiveItem method is called (#20846)
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user