标签:display 识别 document contex fun canvas att 二维码 cal
tips[index].onclick=function(){//识别图中的二维码
var w = $("#app").width();
var h = $("#app").height();
var canvas=document.createElement("canvas")
canvas.width = w * 2;
canvas.height = h * 2;
canvas.style.width = w + "px";
canvas.style.height = h + "px";
var context = canvas.getContext("2d");
context.scale(2,2);
html2canvas($(‘#app‘),{
canvas:canvas,
onrendered: function (canvas) {
$(‘#app‘).css(‘display‘,‘none‘)//将整个大的div
$("#showimg").attr(‘src‘, canvas.toDataURL());
}
})
}
标签:display 识别 document contex fun canvas att 二维码 cal
原文地址:https://www.cnblogs.com/yangwan/p/10384584.html