效果:

代码:
1、在header引入js
<script type='text/javascript' src='http://cdn.staticfile.org/jquery/2.1.1/jquery.min.js'></script> <script type="text/javascript" src="http://cdn.staticfile.org/jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
2、html代码
<div id="qrcode"></div>
<a id="download" download="{$title}.jpg"></a>3、在底部加入js代码
<script>
jQuery('#qrcode').qrcode({ width: 300, height: 300, text: window.location.href });
$("#qrcode").click(function () {
var canvas = $('#qrcode').find("canvas").get(0);
var url = canvas.toDataURL('image/jpeg');
$("#download").attr('href', url).get(0).click();
return false;
});
</script>评论列表:
ftyhj
评论于2020-10-24 13:19:09
5a单号网,专业空包代发网www.5adanhw.com - 回复该评论
发表评论:
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

相关文章
判断主域名的js代码2023-03-30
swiper 选项卡激活指定的swiper-slide2020-04-15
Uncaught TypeError: Cannot read property 'top' of undefined错误应该如何解决2019-07-13