在安卓上canvas和页面上的其他元素滑动起来感觉不同步
发布于 6 年前 作者 min87 3834 次浏览 来自 问答
<view class="container">
  <view  bindtap="bindViewTap" class="userinfo">
    <canvas canvas-id="c1"></canvas>
    <text>TEST</text>
    <canvas canvas-id="c2"></canvas>
    <text>TEST</text>
    <canvas canvas-id="c3"></canvas>
    <text>TEST</text>
    <canvas canvas-id="c4"></canvas>
    <text>TEST</text>
    <canvas canvas-id="c5"></canvas>
    <text>TEST</text>
    <canvas canvas-id="c6"></canvas>
    <text>TEST</text>
  </view>
</view>
onLoad: function () {
  var ctx = wx.createContext();
  ctx.setFillStyle('red');
  ctx.fillRect(10, 10, 150, 75);
  var actions = ctx.getActions();;
 
  ['c1', 'c2', 'c3', 'c4', 'c5', 'c6'].forEach(function(item) {
    wx.drawCanvas({
      canvasId: item,
      actions: actions
    })
  });
}

快速上下滑动页面,可以感觉到canvas比text滑动起来要滞后一点

回到顶部