var bar = require('wxbarcode/demo/utils/barcode.js'); //引入生成条形码方法


function convert_length(length) {
  return Math.round(my.getSystemInfoSync().windowWidth * length / 750);
}

export function barcode(id, code, width, height) {
  //封装展示条形码方法
  bar.code128(my.createCanvasContext(id), code, convert_length(width), convert_length(height));
}