1、wxml中 <canvas style="width: 200px; height: 200px;" canvas-id="myQrcode"></canvas> 2、js 若是项目使用了wepy npm install weapp-qrcode --save import drawQrcode from 'weapp-qrcode' drawQrcode({ width: 200, height: 200, canvasId: 'myQrcode', // ctx: wx.createCanvasContext('myQrcode'), text: 'https://github.com/yingye', // v1.0.0+版本支持在二维码上绘制图片 image: { imageResource: '../../images/icon.png', dx: 70, dy: 70, dWidth: 60, dHeight: 60 } }) 来源:https://www.cnblogs.com/lingshan168/p/10412023.html 标签 canvas qrcode