用第二种的时候还出现 [图片]
official-account组件bindload和binderror两个属性如何触发 没反应 ?我是在uni-app框架写的 是该用第一种呢 还是第二种呢 第一种: [图片] 第二种 [图片] 方法(在methods中写): [图片] 我想知道我哪里写错了吗 两种都试过 没反应 求助
2020-02-20解决了吗
canvas真机预览和真机调试都不显示,开发者工具显示正常这是代码: [图片] 开发者工具显示正常: [图片] 真机预览和真机调试都不显示: [图片] 求大神帮忙!!!
2020-01-13解决了吗?
canvas在开发工具或者真机打开调试模式就能显示,不打开调试模式显示空白?在网上看了好多,也用了downloadFile,白名单也有添加。但是就是没办法显示。没报任何错。这个是什么原因??? 麻烦请大家帮我看看,弄了一个下午就是没有找出原因?@官方 [代码]success: [代码][代码]function[代码][代码](res) {[代码][代码] [代码][代码]console.log(res.data)[代码][代码] [代码][代码]var[代码] [代码]base64 = wx.arrayBufferToBase64(res.data);[代码][代码] [代码][代码]let qrcodeUrl = [代码][代码]"data:image/png;base64,"[代码] [代码]+ base64;[代码][代码] [代码][代码]qrcodeUrl = qrcodeUrl.replace(/[\r\n]/g, [代码][代码]""[代码][代码]);[代码][代码] [代码][代码]wx.getUserInfo({[代码][代码] [代码][代码]withCredentials: [代码][代码]true[代码][代码],[代码][代码] [代码][代码]lang: [代码][代码]''[代码][代码],[代码][代码] [代码][代码]success: [代码][代码]function[代码][代码](res) {[代码][代码] [代码][代码]var[代码] [代码]avatarUrl = res.userInfo.avatarUrl;[代码][代码] [代码][代码]const ctx = wx.createCanvasContext([代码][代码]'share'[代码][代码]);[代码][代码] [代码][代码]ctx.setFillStyle([代码][代码]'white'[代码][代码])[代码][代码] [代码][代码]ctx.fillRect(0, 0, 580, 710)[代码][代码] [代码][代码]// 绘制小程序码[代码][代码] [代码][代码]_this.canvasQR(ctx, base64)[代码][代码] [代码][代码]// 绘制头像[代码][代码] [代码][代码]_this.canvasAvatar(ctx, avatarUrl, _this)[代码][代码] [代码][代码]ctx.draw([代码][代码]true[代码][代码]) [代码][代码]//绘制[代码][代码] [代码][代码]},[代码][代码]drawCircular: [代码][代码]function[代码][代码](ctx, width, height, x, y, url) {[代码] [代码] [代码][代码]var[代码] [代码]avatarurl_width = width;[代码][代码] [代码][代码]var[代码] [代码]avatarurl_heigth = height;[代码][代码] [代码][代码]var[代码] [代码]avatarurl_x = x;[代码][代码] [代码][代码]var[代码] [代码]avatarurl_y = y;[代码][代码] [代码][代码]ctx.save();[代码][代码] [代码][代码]ctx.beginPath();[代码][代码] [代码][代码]ctx.arc(avatarurl_width / 2 + avatarurl_x, avatarurl_heigth / 2 + avatarurl_y, avatarurl_width / 2, 0, Math.PI * 2, [代码][代码]false[代码][代码]);[代码][代码] [代码][代码]ctx.clip();[代码][代码] [代码][代码]ctx.drawImage(url, avatarurl_x, avatarurl_y, avatarurl_width, avatarurl_heigth);[代码][代码] [代码][代码]ctx.restore();[代码][代码] [代码][代码]},[代码][代码] [代码][代码]// 绘制头像[代码][代码] [代码][代码]canvasAvatar: [代码][代码]function[代码] [代码](ctx, avatarUrl, _this){[代码][代码] [代码][代码]wx.downloadFile({[代码][代码] [代码][代码]url: avatarUrl,[代码][代码] [代码][代码]success: res => {[代码][代码] [代码][代码]var[代码] [代码]path = res.tempFilePath [代码][代码]//临时本地路径[代码][代码] [代码][代码]_this.drawCircular(ctx, 46, 46, 27, 27, path);[代码][代码] [代码][代码]ctx.draw([代码][代码]true[代码][代码]) [代码][代码]//绘制[代码][代码] [代码][代码]},[代码][代码] [代码][代码]fail: res => {[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码][代码] [代码][代码]// 绘制小程序码[代码][代码] [代码][代码]canvasQR: [代码][代码]function[代码] [代码](ctx, base64){[代码][代码] [代码][代码]const filePath = `${wx.env.USER_DATA_PATH}/temp_image.png`;[代码][代码] [代码][代码]wx.getFileSystemManager().writeFile({[代码][代码] [代码][代码]filePath,[代码][代码] [代码][代码]data: base64,[代码][代码] [代码][代码]encoding: [代码][代码]'base64'[代码][代码],[代码][代码] [代码][代码]success() {[代码][代码] [代码][代码]var[代码] [代码]QR = filePath;[代码][代码] [代码][代码]ctx.drawImage(QR, 100, 0, 100, 100);[代码][代码] [代码][代码]},[代码][代码] [代码][代码]fail() {[代码][代码] [代码][代码]}[代码][代码] [代码][代码]});[代码][代码] [代码][代码]},[代码]
2020-01-13