From 3a727a6077f3fa95d0636aac61bc3b4bf516a7eb Mon Sep 17 00:00:00 2001 From: DCloud_LXH <283700113@qq.com> Date: Thu, 11 Nov 2021 11:47:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20swiper=20=E6=97=A0=E6=B3=95=E6=BB=91?= =?UTF-8?q?=E5=8A=A8=E7=9A=84=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/view/components/swiper/index.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/view/components/swiper/index.vue b/src/core/view/components/swiper/index.vue index 0f6eb52c3..e5ec90db1 100644 --- a/src/core/view/components/swiper/index.vue +++ b/src/core/view/components/swiper/index.vue @@ -162,6 +162,7 @@ export default { mounted () { this._currentCheck() this.touchtrack(this.$refs.slidesWrapper, '_handleContentTrack', true) + this._resetLayout() this.$watch(() => { return this.autoplay && !this.userTracking }, this._inintAutoplay) @@ -486,6 +487,7 @@ export default { } }, _handleTrackStart () { + if (!this.items.length) return this._cancelSchedule() this._contentTrackViewport = this._viewportPosition this._contentTrackSpeed = 0 @@ -493,6 +495,7 @@ export default { this._cancelViewportAnimation() }, _handleTrackMove (data) { + if (!this.items.length) return var self = this var contentTrackT = this._contentTrackT this._contentTrackT = Date.now() @@ -527,6 +530,7 @@ export default { } }, _handleTrackEnd (isCancel) { + if (!this.items.length) return this.userTracking = false var t = this._contentTrackSpeed / Math.abs(this._contentTrackSpeed) var n = 0 -- GitLab