在一张桌子里( react-data-table-component ),我有元素,这些元素之一,文字必须转换成二维码。
react-data-table-component
我正在尝试各种模块( qrcode.react, react-google-qrcode, etc.
qrcode.react, react-google-qrcode, etc.
问题是它们是组件,因此将它们用作文档的唯一方法是:
<qrCode value = "text" />
因为我必须把它放在一个pdf文件中,我必须生成。
所以我想我用base64编码了这个图像。
但我找不到办法。
你可以用 https://www.npmjs.com/package/qrcode
QRCode.toDataURL(<YOUR_DATASET>, {type: "png"}) .then(img => { // Then you can do whatever you want with this img })