diff --git a/src/components/carousel/carousel.vue b/src/components/carousel/carousel.vue
index a219d43..4ab1ad9 100644
--- a/src/components/carousel/carousel.vue
+++ b/src/components/carousel/carousel.vue
@@ -186,7 +186,7 @@
this.currentIndex = index;
},
dotsEvent (event, n) {
- if (event === this.trigger) {
+ if (event === this.trigger && this.currentIndex !== n) {
this.$emit('on-change', this.currentIndex, n);
this.currentIndex = n;
}
@@ -210,7 +210,8 @@
autoplaySpeed () {
this.setAutoplay();
},
- currentIndex () {
+ currentIndex (val, oldVal) {
+ this.$emit('on-change', oldVal, val);
this.$nextTick(() => {
this.trackLeft = this.currentIndex * this.listWidth;
});
diff --git a/test/routers/carousel.vue b/test/routers/carousel.vue
index 8d43584..20e3ad4 100644
--- a/test/routers/carousel.vue
+++ b/test/routers/carousel.vue
@@ -54,6 +54,7 @@
:dots="dots"
:trigger="trigger"
:arrow="arrow"
+ @on-change="slideChange"
easing="linear">
{{item}}
+