微信小程序数据绑定延迟很严重呀,有没有这种感觉啊?请看举例!!
发布于 6 年前 作者 xiuying63 5776 次浏览 来自 问答

现象描述:页面代码<view style=“left:{{x}}px;top:{{y}}px;”>+1</view>   在页面中有好多小球,点击小球时就在小球的位置出现+1, 预期结果:每点击的时候动态修改x,y的值 让+1出现在小球的位置。

实际结果:点击之后 +1出现延迟近10s左右,假如一连串点了5个球,过了一段时间才看见+1的位置才陆续变化!

3 回复
mytouchstart:function(e){
 
 
var x_point = e.touches[0].x;
var y_point =e.touches[0].y;
  
 
 this.setData({ thescorestyle_left: x_point, thescorestyle_top: y_point});
 
}

上面这个是js 代码

<canvas canvas-id="canvas" bindtouchstart="mytouchstart" style='width:{{canvasWidth}}px; height:{{canvasHeight}}px;'></canvas>  
         <view class="thescore" style="left:{{thescorestyle_left}}px;top:{{thescorestyle_top}}px;font-size:18px;" >+1</view>

上面这个是页面代码

你直接 在canvas 上搞不就好了吗

来个代码片段看看?

回到顶部