使用jquery qrcode生成二维码

引用jquery qrcodejs文件

引用方式一(github中下载):

下载地址:https://github.com/jeromeetienne/jquery-qrcode
在这里插入图片描述
下载到本地后,在html页面中引入该js文件即可。

引用方式二(cdn中直接引用)

https://www.bootcdn.cn/jquery.qrcode/
在这里插入图片描述

代码实现

<!Doctype html>
<head>
<title>撸起袖子加油干</title>
<meta charset='utf-8'>
</head>
<body>
<div id="qrcode"></div>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script>
<script src="https://cdn.bootcss.com/jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
<script type="text/javascript">
    $('#qrcode').qrcode("http://www.wangchuangcode.cn");
    $('#qrcode').qrcode({width: 64,height: 64,text: "http://www.baidu.com"});
</script>
</body>
</html>

在这里插入图片描述

参数详解

红框框里的内容可以为文字,也可以为要跳转的网址。

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_42249896/article/details/87981253