安装依赖包
npm install jsbarcode --save 😄
在使用页面引入依赖包
import JsBarcode from 'jsbarcode'
定义img标签和id
<img id="barcode" />
在使用页面开始生成
JsBarcode('#barcode', 'DY2020080400088', {
format: 'CODE39',
lineColor: '#000',
background: '#EBEEF5',
width: 2,
height: 40,
displayValue: false
})

官方文档
https://github.com/lindell/JsBarcode#readme
https://www.npmjs.com/package/jsbarcode
网友评论