123456789101112131415161718192021222324 |
- const barcode = require('./barcode');
- const qrcode = require('./qrcode');
- function convert_length(length) {
- return Math.round(my.getSystemInfoSync().windowWidth * length / 750);
- }
- function barc(id, code, width, height) {
- barcode.code128(my.createCanvasContext(id), code, convert_length(width), convert_length(height));
- }
- function qrc(id, code, width, height) {
- qrcode.api.draw(code, {
- ctx: my.createCanvasContext(id),
- width: convert_length(width),
- height: convert_length(height)
- });
- }
- module.exports = {
- barcode: barc,
- qrcode: qrc
- };
|