收藏
回答

PC微信 wx.canvasToTempFilePath 下载 canvas 2D无反应

PC微信    wx.canvasToTempFilePath    下载 canvas 2D无反应,也没有回调

 wx.canvasToTempFilePath({
                x: 0,
                y: 0,
                width: that.data.width,
                height: that.data.height,
                destWidth:that.data.width*this.data.pr,
                destHeight: that.data.height*this.data.pr,
                canvasId: 'canvas',
                canvas: that.data.canvas,
                fileType: 'png',
                success(res) {
                    console.log(33333333333)
                    console.log(res.tempFilePath)
                    let filePath = res.tempFilePath;
                    wx.showToast({
                        title: '生成成功',
                        icon: 'none'
                    })
                    return false
                
                },fail(err) {
                    console.log(2222222222222)
                    wx.hideLoading()


                    wx.showToast({
                        title: '生成失败',
                        icon: 'none'
                    })
                    wx.showModal({
                        title: '提示',
                        confirmText: '去设置',
                        content: '保存失败,请确认是否同意允许该小程序访问相册',
                        success(res) {
                            if (res.confirm) {
                                wx.openSetting({
                                    success(res) {}
                                })
                            } else if (res.cancel) {


                            }
                        }
                    })
                },complete(comp){
                    console.log(comp)
                } 
            },that)



去掉  canvas: that.data.canvas    就会有错误的回调



回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容