added on-change event emitter

This commit is contained in:
Rijn 2017-01-17 14:35:23 -06:00
parent e9989f2b85
commit c1af3facb0
2 changed files with 12 additions and 3 deletions

View file

@ -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;
});