自动生成本页二维码
    
    
    
    
实现代码
<!DOCTYPE html>
<html>
<head>
    <title>当前链接二维码</title>
    <script src="https://cdn.jsdelivr.net/npm/qrcode@1.5.3/build/qrcode.min.js"></script>
    <style>
        #qrcode { margin: 20px auto; width: 200px; }
    </style>
</head>
<body>
    <div id="qrcode"></div>
    <script>
        document.addEventListener('DOMContentLoaded', () => {
            new QRCode(document.getElementById('qrcode'), {
                text: window.location.href,  // 自动获取当前页面URL
                width: 150,
                height: 150,
                colorDark: "#000000",
                colorLight: "#ffffff",
                correctLevel: QRCode.CorrectLevel.H
            });
        });
    </script>
</body>
</html>
© 2025 WWW.LIAOTUO.CN 了脱杂货铺