const ctx = wx.createCanvasContext('share'); ctx.fillStyle = "#ffffff";
canvas生成的图片为什么是透明的?[图片] 在其他的地方打开就是黑色的,我设置canvas的背景色是白色的,难道填充不了? [图片] [代码]<[代码][代码]canvas[代码] [代码]canvas-id[代码][代码]=[代码][代码]'share'[代码] [代码]style[代码][代码]=[代码][代码]"display:{{canvasbox}};width:750rpx;height:1334rpx;margin:auto;background-color:rgba(255,255,255,1);"[代码][代码]></[代码][代码]canvas[代码][代码]>[代码] [代码] [代码][代码] [代码][代码]// 将生成的canvas图片,转为真实图片[代码][代码] [代码][代码]wx.canvasToTempFilePath({[代码][代码] [代码][代码]x: 0,[代码][代码] [代码][代码]y: 0,[代码][代码] [代码][代码]width: 375,[代码][代码] [代码][代码]height: 667,[代码][代码] [代码][代码]destWidth: 375,[代码][代码] [代码][代码]destHeight: 667,[代码][代码] [代码][代码]canvasId: [代码][代码]'share'[代码][代码],[代码][代码] [代码][代码]success: [代码][代码]function[代码] [代码](res) {[代码][代码] [代码][代码]let shareImg = res.tempFilePath;[代码][代码] [代码][代码]console.log([代码][代码]"shareImg:"[代码][代码], shareImg)[代码][代码] [代码][代码]// 获取用户是否开启用户授权相册[代码][代码] [代码][代码]wx.getSetting({[代码][代码] [代码][代码]success(res) {[代码][代码] [代码][代码]// 如果没有则获取授权[代码][代码] [代码][代码]if[代码] [代码](!res.authSetting[[代码][代码]'scope.writePhotosAlbum'[代码][代码]]) {[代码][代码] [代码][代码]wx.authorize({[代码][代码] [代码][代码]scope: [代码][代码]'scope.writePhotosAlbum'[代码][代码],[代码][代码] [代码][代码]success() {[代码][代码] [代码][代码]wx.saveImageToPhotosAlbum({[代码][代码] [代码][代码]filePath: shareImg,[代码][代码] [代码][代码]success(res) {[代码][代码] [代码][代码]console.log([代码][代码]"保存失败:"[代码][代码], res)[代码][代码] [代码][代码]wx.hideLoading()[代码][代码] [代码][代码]wx.showToast({[代码][代码] [代码][代码]title: [代码][代码]'保存成功'[代码][代码] [代码][代码]})[代码] [代码] [代码][代码]},[代码][代码] [代码][代码]fail(res) {[代码][代码] [代码][代码]console.log([代码][代码]"保存失败:"[代码][代码], res)[代码][代码] [代码][代码]wx.hideLoading()[代码][代码] [代码][代码]wx.showToast({[代码][代码] [代码][代码]title: [代码][代码]'保存失败'[代码][代码],[代码][代码] [代码][代码]icon: [代码][代码]'none'[代码][代码] [代码][代码]})[代码] [代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码][代码] [代码][代码]fail() {[代码][代码] [代码][代码]// 如果用户拒绝过或没有授权,则再次打开授权窗口[代码][代码] [代码][代码]//(ps:微信api又改了现在只能通过button才能打开授权设置,以前通过openSet就可打开,下面有打开授权的button弹窗代码)[代码][代码] [代码][代码]that.setData({[代码][代码] [代码][代码]openSet: [代码][代码]true[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]} [代码][代码]else[代码] [代码]{[代码][代码] [代码][代码]// 有则直接保存[代码][代码] [代码][代码]wx.saveImageToPhotosAlbum({[代码][代码] [代码][代码]filePath: res.tempFilePath,[代码][代码] [代码][代码]success() {[代码][代码] [代码][代码]console.log([代码][代码]"保存成功:"[代码][代码], res)[代码][代码] [代码][代码]wx.hideLoading()[代码][代码] [代码][代码]wx.showToast({[代码][代码] [代码][代码]title: [代码][代码]'保存成功'[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码][代码] [代码][代码]fail(res) {[代码][代码] [代码][代码]console.log([代码][代码]"保存失败:"[代码][代码],res)[代码][代码] [代码][代码]wx.hideLoading()[代码][代码] [代码][代码]wx.showToast({[代码][代码] [代码][代码]title: [代码][代码]'保存失败'[代码][代码],[代码][代码] [代码][代码]icon: [代码][代码]'none'[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码][代码] [代码][代码]fail: [代码][代码]function[代码] [代码](res) {[代码][代码] [代码][代码]console.log([代码][代码]"生成图片失败!"[代码][代码], res)[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码]
2019-11-19其他机型是正常的
picker选项文字在华为nova2上被截断是什么原因?[图片]
2019-11-12