- canvas 2d createImage 网络图片报错500?
<canvas type="2d" id="canvas" style="width: 300px; height: 300px;" ></canvas> const app = getApp() Page({ data: {}, onLoad: function () { // 通过 SelectorQuery 获取 Canvas 节点 setTimeout(() => { wx.createSelectorQuery() .select('#canvas') .fields({ node: true, size: true, }) .exec(this.init.bind(this)) }, 2000); }, init(res) { const width = res[0].width const height = res[0].height const canvas = res[0].node const ctx = canvas.getContext('2d') const dpr = wx.getSystemInfoSync().pixelRatio canvas.width = width * dpr canvas.height = height * dpr ctx.scale(dpr, dpr) var that = this; wx.downloadFile({ url: 'https://weixin-mini-1303103681.cos.ap-nanjing.myqcloud.com/qrcode/logo.png', success: function (res1) { const img = canvas.createImage() img.src = res1.tempFilePath img.onload = () => { ctx.drawImage(img, 0, 150 - 25, 100, 50) } } }) }, }) [图片] 然而,我重新建了demo,同样的代码,调试基础库也是一样的,就可以使用。 [图片]
2021-09-25 - 开发工具Network不显示问题
Network一直不显示接口请求 [图片] 接口返回消息已经在console打印出来了,但是Network中一直没有任何内容 [图片]
2020-09-09