Vue 生成条形码 jsbarcode的使用

安装依赖包

npm install jsbarcode --save 😄

在使用页面引入依赖包

import JsBarcode from 'jsbarcode'

定义img标签和id

<img id="barcode" />

在使用页面开始生成,可以写在方法中或者mounted中

  JsBarcode('#barcode', 'DY2020080400088', {
      format: 'CODE39',
      lineColor: '#000',
      background: '#EBEEF5',
      width: 2,
      height: 40,
      displayValue: false
    })
posted @ 2020-07-21 23:39  荣光无限  阅读(5096)  评论(0编辑  收藏  举报