條形碼:
使用jsbarcode:
官網(wǎng):
https://lindell.me/JsBarcode/
簡單使用如下:

vue用法:
1.npm install jsbarcode --save
2.在需要使用的vue頁面里面引用:
import JsBarcode from 'jsbarcode'
3.界面中使用:
<div? style="text-align: center;" ><svg id="barcode" ></svg></div>
4.js:
JsBarcode("#barcode", "123456789",{ fontSize:14, });
詳細(xì)參數(shù)參考官方文檔。
二維碼:
使用qrcodejs2:
沒有找到官網(wǎng),可以參考npmjs:
https://www.npmjs.com/package/qrcodejs2
vue用法:
1.npm install qrcodejs2 --save
2.在需要使用的頁面中引用:
import QRCode from 'qrcodejs2'
3.頁面:
<div style="display: flex;justify-content: center;" id='qrcode'></div>
4.js:
if(!this.qrCode){
this.qrCode = new QRCode('qrcode', { width: 150, height: 150, })??
?this.qrCode.clear();
var QRCodeStr = "123456789";?
?this.qrCode.makeCode(QRCodeStr);?}