第一次通过 style 拖动图片时候是正常的。执行了 animation 之后,用 style 拖动就不正常了。不受控制了。麻烦您给看一下。
animation.export() 之后,style 里面依然保留的,动画结束后未删除。
下面是相关代码
wxml
<view animation="{{anim}}" style="position: absolute;left:{{left}};top:{{top}};" bindtouchmove="bindtouchmove" bindtouchend="bindtouchend"> <image src="http://wx4.sinaimg.cn/mw690/473fa942gy1g3de7bj19fj21900u0anq.jpg"></image> </view> |
js
Page({ data: { xx: 0, yy: 0 }, onLoad: function() { this.animation = wx.createAnimation() }, bindtouchmove: function(e) { //第一次拖动正常,执行过animation 之后就出错了 console.log('第一次拖动正常,执行过animation 之后就出错了') var left = e.touches[0].clientX var top = e.touches[0].clientY this.setData({ left: left + 'px', top: top + 'px' }); }, bindtouchend: function(e) { //拖动结束后返回远点 this.animation.left(0 + 'rpx') this.animation.top(0 + 'rpx').step() this.setData({ anim: this.animation.export() }) }}) |

楼主问题
第一次: 可以随意拖动
之后就只能左右了..
查找后发现问题
少数写一个; 号...已标注,,,萌新路过
4年了 微信还没解决这问题,真够可以的
楼主解决了吗,遇到同样问题,能不能删除执行后的动话