This commit is contained in:
梁灏 2018-02-28 15:38:20 +08:00
parent ab3ff750a3
commit 2073853e87
2 changed files with 26 additions and 30 deletions

View file

@ -243,8 +243,8 @@
this.updateTrackPos(this.hideTrackPos);
}
//
let index = this.showCopyTrack ? this.copyTrackIndex : this.trackIndex;
index += offset;
const oldIndex = this.showCopyTrack ? this.copyTrackIndex : this.trackIndex;
let index = oldIndex + offset;
while (index < 0) index += slidesLen;
if (((offset > 0 && index === slidesLen) || (offset < 0 && index === slidesLen - 1)) && this.loop) {
// - 1
@ -255,7 +255,9 @@
if (!this.loop) index = index % this.slides.length;
this.updateTrackIndex(index);
}
this.$emit('input', index === this.slides.length ? 0 : index);
this.currentIndex = index === this.slides.length ? 0 : index;
this.$emit('on-change', oldIndex, this.currentIndex);
this.$emit('input', this.currentIndex);
},
arrowEvent (offset) {
this.setAutoplay();
@ -294,9 +296,6 @@
autoplaySpeed () {
this.setAutoplay();
},
currentIndex (val, oldVal) {
this.$emit('on-change', oldVal, val);
},
trackIndex () {
this.updateOffset();
},