收藏
回答

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

框架类型 问题类型 API/组件名称 终端类型 微信版本 基础库版本
小程序 Bug canvas 2d 工具 PC端微信 2.10



PC端微信没有反应 也没有回调

    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'
                    })

                },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 个回答

登录 后发表内容