qr-code-library-mars
v2.1.4
Published
```bash npm i qr-code-library-mars ``` ```bash npm i qr-code-styling ```
Downloads
8
Readme
#Installation
npm i qr-code-library-mars
npm i qr-code-styling
After installing these packages you should add a div its id is 'canvas' so there would be a place for qr to shown.
<div id="canvas"></div>
Also when you want to trigger the function called updateQRCode, you need the pass these parameters.
corporateId userId orderId cardAmount
You can custimize your own button for calling this function.
#Usage
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>QR Code Library</title>
</head>
<body>
<h1>QR Code Library Test</h1>
<div id="canvas"></div>
<button id="generateQRCode">Generate QR Code</button>
<script src="dist/qrCodeLibrary.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function() {
const QRCodeGenerator = QRCodeLibrary.default;
const qrGenerator = new QRCodeGenerator({
width: 300,
height: 300
});
document.getElementById('generateQRCode').addEventListener('click', function() {
const corporateId = 'corp123';
const userId = 'user456';
const orderId = 'order789';
const cardAmount = '100';
qrGenerator.updateQRCode(corporateId, userId, orderId, cardAmount);
});
});
</script>
</body>
</html>