We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
用到了 soldair / node-qrcode 这个库。
核心代码如下:
// 引入依赖 import QRCode from 'qrcode' const opts = { // 7% 的容错率 errorCorrectionLevel: 'L', // PNG 格式图片 type: 'png', // 码点与图片边界留出两个码点的距离 margin: 2, // 图片宽高为 260px width: 260, } // 生成二维码 const img = await QRCode.toDataURL(url, opts) // 将二维码的内容显示在 img 元素中 document.querySelectorAll('.qrcode img')[i].src = img
用到了 nuintun / qrcode 这个库。
// 引入依赖 import { Decoder } from '@nuintun/qrcode' // 检查二维码 // 这里的 img 为前面生成二维码时保存的 img 变量 const qrcode = new Decoder() const result = await qrcode.scan(img) // 解析出的二维码 URL 就在 data 属性中 if (result.data === ...)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
实现方案
二维码生成
用到了 soldair / node-qrcode 这个库。
核心代码如下:
二维码检查
用到了 nuintun / qrcode 这个库。
核心代码如下:
The text was updated successfully, but these errors were encountered: