added on-change event emitter
This commit is contained in:
parent
e9989f2b85
commit
c1af3facb0
2 changed files with 12 additions and 3 deletions
|
@ -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;
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue