使用 jsbarcode 生成条形码

1、安装 jsbarcode

yarn add jsbarcode

2、使用:


 

 ....

 import JsBarcode from "jsbarcode";

 ...

 setQrCode(txt) {
      const options = {
        format: "CODE39", //选择要使用的条形码类型
        lineColor: "#000", //条码颜色
        width: 3, //条码之间的距离
        height: 100, //条码高度
        displayValue: true, 是否在条形码下方显示文字
      };
      JsBarcode("#barcode", txt, options);
  },

 setQrCode("123456");

效果:
使用 jsbarcode 生成条形码_第1张图片

你可能感兴趣的:(vue,vue.js,前端)