Skip to content

Commit

Permalink
fix: 解决swiper动画过程中销毁组件会报错的问题 fixed #1127
Browse files Browse the repository at this point in the history
  • Loading branch information
zhetengbiji committed Dec 19, 2019
1 parent 1d54fb9 commit c576892
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core/view/components/swiper/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ export default {
},
beforeDestroy () {
this._cancelSchedule()
cancelAnimationFrame(this._animationFrame)
},
methods: {
_inintAutoplay (enable) {
Expand Down Expand Up @@ -421,7 +422,7 @@ export default {
var s = acc * time * time / 2
var l = toPos + s
this._updateViewport(l)
requestAnimationFrame(this._animateFrameFuncProto.bind(this))
this._animationFrame = requestAnimationFrame(this._animateFrameFuncProto.bind(this))
},
_animateViewport (current, source, n) {
this._cancelViewportAnimation()
Expand Down Expand Up @@ -464,7 +465,7 @@ export default {
}
if (!this._requestedAnimation) {
this._requestedAnimation = true
requestAnimationFrame(this._animateFrameFuncProto.bind(this))
this._animationFrame = requestAnimationFrame(this._animateFrameFuncProto.bind(this))
}
},
_cancelViewportAnimation () {
Expand Down

0 comments on commit c576892

Please sign in to comment.