basic QR Code generator

This commit is contained in:
CPunisher 2020-05-01 16:38:42 +08:00
parent 0fb64ea060
commit 0f66ceea9d
3 changed files with 17092 additions and 0 deletions

15824
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

1239
src/utils/qrcode.js Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,29 @@
import QRCode from "./qrcode";
function extend(target, options) {
for (let name in options) {
target[name] = options[name]
}
return target
}
export function getQrcodeData(options) {
if (!options.text || options.text.length <= 0) return null
options = extend({
render : "canvas",
width : 256,
height : 256,
typeNumber : -1,
correctLevel : 2,
background : "#ffffff",
foreground : "#000000"
}, options);
let qrcode = new QRCode(options.typeNumber, options.correctLevel)
qrcode.addData(options.text)
qrcode.make()
return qrcode;
}