html文件:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>二维码</title>
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<script type="text/javascript" src="./public/js/qrcode.min.js"></script>
<script type="text/javascript" src="./public/js/jquery-1.10.2.min.js"></script>
</head>
<body style="background:#fff;">
<div class="order_title">二维码</div>
<div style="width:100%; background:#FFF; text-align: center">
<div id="qrcode" style="margin: 0 auto;width:200px;height:200px;margin-top: 40px;"></div>
<h2 style="padding-top: 20px;letter-spacing: 3px;margin-bottom: 40px;"><span style="font-size: 14px;font-weight: initial;"></span></h2>
</div>
</body>
<script>
//js生成二维码
var qrcode = new QRCode(document.getElementById("qrcode"), {
width : 200,
height : 200
});
function makeCode () {
var content='123456'; //这是二维码的内容
qrcode.makeCode(content);
}
makeCode();
</script>
</html>
结果:
自己要去下载qrcode.min.js
我的demo也全部弄好了,直接下载解压就能用
链接:https://pan.baidu.com/s/1zOdENi_7NEQZr6EhmrO5zA
提取码:1o5k