Skip to content

Commit

Permalink
fix(slide): goToPage direction (didi#384)
Browse files Browse the repository at this point in the history
* fix(slide): goToPage direction

* fix: remove default time value in goToPage function
  • Loading branch information
tank0317 authored and dolymood committed Jan 22, 2019
1 parent 2ce3d28 commit b45c51c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/components/slide/slide.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
watch: {
initialIndex(newIndex) {
if (newIndex !== this.currentPageIndex) {
this.slide && this.slide.goToPage(newIndex)
this._goToPage(newIndex)
}
}
},
Expand Down Expand Up @@ -208,7 +208,7 @@
this.slide.on('scrollEnd', this._onScrollEnd)
this.slide.goToPage(this.currentPageIndex, 0, 0)
this._goToPage(this.currentPageIndex, 0)
/* dispatch scroll position constantly */
if (this.options.listenScroll && this.options.probeType === 3) {
Expand Down Expand Up @@ -281,6 +281,13 @@
}
this._refresh()
}, 60)
},
_goToPage(index, time) {
if (this.direction === DIRECTION_H) {
this.slide && this.slide.goToPage(index, 0, time)
} else if (this.direction === DIRECTION_V) {
this.slide && this.slide.goToPage(0, index, time)
}
}
},
mounted() {
Expand Down

0 comments on commit b45c51c

Please sign in to comment.