uni-app QR code generation (link to QR code)

// 引入二维码库  
import QR from "../../utils/wxqrcode.js" // 二维码生成器  

let img = QR.createQrCodeImg('生成的内容', {  
     size: parseInt(300)//二维码大小  
})

Plug-in download address: https://ask.dcloud.net.cn/article/34931

Notice! ! : When uni-app generates a QR code, once the string length of the generated QR code is greater than a certain number of bytes, an error will be reported. gen() This method is undefined

method one:

Change: var typeNumber = options.typeNumber || 4;
to: var typeNumber = options.typeNumber || 8;
or add typeNumber: 8 as the second parameter when calling createQrCodeImg.

Method Two:

Line 1606, replace gen with createQrCodeImg

Guess you like

Origin blog.csdn.net/weixin_44285250/article/details/107691501