收藏
回答

wx.canvasToTempFilePath(不使用context.draw())生成的图片空白?

使用Canvas 2D 接口(需指定 type 属性),在setTimeout函数里面调用 canvasToTempFilePath ,生成的图片是空白的。

          setTimeout(function () {
                    wx.canvasToTempFilePath({
                        canvas:cvs,
                        fileType: 'jpg',
                        quality: 1,
                        destWidth: width,
                        destHeight: height,
                        success: function (ress) {
                            console.log("生成的图片")
                            console.log(ress)
                            wx.hideLoading();
                            typeof callback == "function" && callback(ress);
                        },
                        fail:function(ress){
                            console.log(ress)
                            wx.hideLoading();
                        }
                    },cvs)
                },1000)
回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容