Commit 23e81831 authored by HarlanLuo's avatar HarlanLuo

Carousel: stop timer before component destroyed (#13820)

parent 16311d1e
......@@ -181,11 +181,14 @@ export default {
},
pauseTimer() {
if (this.timer) {
clearInterval(this.timer);
this.timer = null;
}
},
startTimer() {
if (this.interval <= 0 || !this.autoplay) return;
if (this.interval <= 0 || !this.autoplay || this.timer) return;
this.timer = setInterval(this.playSlides, this.interval);
},
......@@ -257,6 +260,7 @@ export default {
beforeDestroy() {
if (this.$el) removeResizeListener(this.$el, this.resetItemPosition);
this.pauseTimer();
}
};
</script>
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