页面canvas随长页面滑动,css设置好似失效时。
一般多为父元素使用了position之类,其余的少见看详情。
重写下样式和布局即可。

解决:把canvas生成后换成image展示
bug触发几率看链接1,其余看链接2
ctx.draw(true, function () {
wx.canvasToTempFilePath({
canvasId: "myCanvas",
success(res) {
console.log('myCanvasr',res);
if (res.tempFilePath) {
self.setData({
showCanvaImg: true,
canvasImgUrl: res.tempFilePath,
});
}
console.log('替换图片',res.tempFilePath)
},
fail(err) {
console.log('绘图失败',err)
}
});
});
...
<canvas wx:if="{{!showCanvaImg}}" id="myCanvas" ></canvas>
<image wx:else class="fin-char" src="{{canvasImgUrl}}"></image>
ps:
https://developers.weixin.qq.com/community/develop/doc/07f5948feb7ebbfb46c3b63a1206e298
https://blog.csdn.net/xd_yangxiaoromg/article/details/88258744
网友评论