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',
text: 'https://github.com/yingye',
image: {
imageResource: '../../images/icon.png',
dx: 70,
dy: 70,
dWidth: 60,
dHeight: 60
}
})