Skip to content

Commit b45c51c

Browse files
tank0317dolymood
authored andcommitted
fix(slide): goToPage direction (#384)
* fix(slide): goToPage direction * fix: remove default time value in goToPage function
1 parent 2ce3d28 commit b45c51c

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/components/slide/slide.vue

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
watch: {
130130
initialIndex(newIndex) {
131131
if (newIndex !== this.currentPageIndex) {
132-
this.slide && this.slide.goToPage(newIndex)
132+
this._goToPage(newIndex)
133133
}
134134
}
135135
},
@@ -208,7 +208,7 @@
208208
209209
this.slide.on('scrollEnd', this._onScrollEnd)
210210
211-
this.slide.goToPage(this.currentPageIndex, 0, 0)
211+
this._goToPage(this.currentPageIndex, 0)
212212
213213
/* dispatch scroll position constantly */
214214
if (this.options.listenScroll && this.options.probeType === 3) {
@@ -281,6 +281,13 @@
281281
}
282282
this._refresh()
283283
}, 60)
284+
},
285+
_goToPage(index, time) {
286+
if (this.direction === DIRECTION_H) {
287+
this.slide && this.slide.goToPage(index, 0, time)
288+
} else if (this.direction === DIRECTION_V) {
289+
this.slide && this.slide.goToPage(0, index, time)
290+
}
284291
}
285292
},
286293
mounted() {

0 commit comments

Comments
 (0)