通过bower进行获取:

y@y:ydkt$ bower install jquery-qrcode --save
bower not-cached git://github.com/gcusnieux/jquery-qrcode.git#*
bower resolve git://github.com/gcusnieux/jquery-qrcode.git#*
bower checkout jquery-qrcode#master
bower resolved git://github.com/gcusnieux/jquery-qrcode.git#31e056e747
bower install jquery-qrcode#31e056e747 jquery-qrcode#31e056e747 client/bower_components/jquery-qrcode
y@y:ydkt$

使用:

.modal.fade(id="qrcode" role="dialog")
.modal-dialog
.modal-content
.modal-header
button.close(type="button" data-dismiss="modal" aria-label="Close")
span(aria-hidden="true") ×
h4.modal-title 在线生成二维码
.modal-body
form(name="qrcodeForm")
input.form-control(placeholder="请输入内容..." required="true" ng-change="createQrCode()" ng-model="qrcodeInfo")
br
#qrcodeCanvas.text-center
.modal-footer
button.btn.btn-default(data-dismiss="modal") 关闭
//在线生成二维码
$scope.createQrCode = function(){
//首先清除
jQuery('#qrcodeCanvas').html(""); if($scope.qrcodeInfo!==undefined){
jQuery('#qrcodeCanvas').qrcode({
width: 256,
height: 256,
text : toUtf8($scope.qrcodeInfo)
});
}
}; //解决二维码中的中文乱码问题
function toUtf8(str) {
var out, i, len, c;
out = "";
len = str.length;
for(i = 0; i < len; i++) {
c = str.charCodeAt(i);
if ((c >= 0x0001) && (c <= 0x007F)) {
out += str.charAt(i);
} else if (c > 0x07FF) {
out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F));
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
} else {
out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F));
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
}
}
return out;
}

jquery-qrcode在线生成二维码的更多相关文章

  1. 使用jquery.qrcode.js生成二维码

    通常生成二维码的方式有两种:第一种是java代码的形式,第二种是通过Js方式. 在这里我做个记录,用js生成二维码,可以在官网下载源码:http://jeromeetienne.github.io/j ...

  2. 转: jquery.qrcode.js生成二维码插件&转成图片格式

    原文地址: https://blog.csdn.net/u011127019/article/details/51226104 1.qrcode其实是通过使用jQuery实现图形渲染,画图,支持can ...

  3. jquery.qrcode.js生成二维码(前端生成二维码)

    官网地址:http://jeromeetienne.github.io/jquery-qrcode/ 第一步引入插件: <script type='text/javascript' src='h ...

  4. jquery.qrcode.js 生成二维码并支持中文的方法

    GitHub地址: https://github.com/jeromeetienne/jquery-qrcode <div class="QR"></div> ...

  5. jquery.qrcode.js生成二维码

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  6. h5开发app之在线生成二维码

    h5通过jquery和qrcode在线生成二维码 首先我们需要下载一个qrcode.js文件,然后依次引入jquery和qrcode文件. 1.创建一个输入框以便做演示使用: <input id ...

  7. 利用QrCode.Net生成二维码 asp.net mvc c#

    利用QrCode.Net生成二维码 asp.net mvc c# 里面介绍了.net的方式及js的方式,还不错. 里面用到的qrcode.net的类库下载地址:https://qrcodenet.co ...

  8. QRCode.js生成二维码

    QRCode的GitHub地址: https://github.com/KeeeX/qrcodejs 该版本解决了主版本(https://github.com/davidshimjs/qrcodejs ...

  9. qrcode.js生成二维码因字符串过长而报错

    前端使用qrcode.js生成二维码的时候.有时候是会出现 qrcode length overflow (1632>1056) 目前使用的有效的解决办法是重新下载新版的qrcode.js 下载 ...

随机推荐

  1. 关于在SLES11, RHEL6, OEL6 and UEK2 Kernels使用hugepages的告警

    ALERT: Disable Transparent HugePages on SLES11, RHEL6, OEL6 and UEK2 Kernels (Doc ID 1557478.1) Modi ...

  2. jquery动态添加元素无法触发绑定事件的解决方案。

    jquery动态添加元素无法触发绑定的事件的解决方案. ╭(●`∀´●)╯二狗最近在工作中遇到一个问题,即当用jquery动态添加元素后,发现给动态添加的元素却无法触发事件(╯#-_-)╯╧═╧ ( ...

  3. javascript获取对应页面的代码

    window.onload = function () { function getUrls(url) {//核心代码是url2这行代码,通过.replace()方法将对应的字符串替换成其他方式 va ...

  4. 用js代码判断是否IE浏览器

    判断是否IE的方法: var isIE = function(ver) { var div = document.createElement("div"), status; div ...

  5. Spark HA 的搭建

    接hadoop HA的搭建,因为你zookeeper已经部署完成,所以直接安装spark就可以 tar –xzf spark-1.6.1-bin-hadoop2.6.tgz -C ../service ...

  6. poj 3671 Dining Cows (Dp)

    /* 一开始并没有想出On的正解 后来发现题解的思路也是十分的巧妙的 还是没能把握住题目的 只有1 2这两个数的条件 dp还带练练啊 ... */ #include<iostream> # ...

  7. zookeeper管理solr的配置文件

    zookeeper可以管理solr和其他软件的配置文件.配置文件还是保存在linux服务器的磁盘上,但是不是改变solr读取solr/home配置的配置文件的位置. 现在solr/home配置文件的位 ...

  8. 第一个androidAPP项目总结—数据请求

    1.使用 ShenBuLuoHttpImpl.getMHttpImpl(context).getAddressList(mod.getCouponCode(), new HttpAfter() { @ ...

  9. Android学习笔记:如何设置ImageView中图片的显示方式

    我们在用ImageView显示图片时,很多情况下图片的大小与ImageView的尺寸不是完全一样的.这时就涉及到该如何设置显示图片了. ImageView有个重要的属性是ScaleType,该属性用以 ...

  10. ASP.NET实现年月日三级联动(局部刷新)

    直接上代码,不多说别的了 <asp:ScriptManager ID="ScriptManager1" runat="server"> </a ...