提交 c576892e 编写于 作者: Q qiang

fix: 解决swiper动画过程中销毁组件会报错的问题 fixed #1127

上级 1d54fb9f
...@@ -166,6 +166,7 @@ export default { ...@@ -166,6 +166,7 @@ export default {
}, },
beforeDestroy () { beforeDestroy () {
this._cancelSchedule() this._cancelSchedule()
cancelAnimationFrame(this._animationFrame)
}, },
methods: { methods: {
_inintAutoplay (enable) { _inintAutoplay (enable) {
...@@ -421,7 +422,7 @@ export default { ...@@ -421,7 +422,7 @@ export default {
var s = acc * time * time / 2 var s = acc * time * time / 2
var l = toPos + s var l = toPos + s
this._updateViewport(l) this._updateViewport(l)
requestAnimationFrame(this._animateFrameFuncProto.bind(this)) this._animationFrame = requestAnimationFrame(this._animateFrameFuncProto.bind(this))
}, },
_animateViewport (current, source, n) { _animateViewport (current, source, n) {
this._cancelViewportAnimation() this._cancelViewportAnimation()
...@@ -464,7 +465,7 @@ export default { ...@@ -464,7 +465,7 @@ export default {
} }
if (!this._requestedAnimation) { if (!this._requestedAnimation) {
this._requestedAnimation = true this._requestedAnimation = true
requestAnimationFrame(this._animateFrameFuncProto.bind(this)) this._animationFrame = requestAnimationFrame(this._animateFrameFuncProto.bind(this))
} }
}, },
_cancelViewportAnimation () { _cancelViewportAnimation () {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册