This commit is contained in:
pplokijuhyg 2020-02-07 18:40:22 +08:00
parent e79d27601b
commit e078f996a1

View File

@ -24,12 +24,7 @@ $(".download").click(() => {
x:(document.body.scrollWidth - width)/2, x:(document.body.scrollWidth - width)/2,
y:0 y:0
}).then(canvas => { }).then(canvas => {
// canvas为转换后的Canvas对象
// imgBlob = canvas.toDataURL('image/jpeg', 1.0);
// imgBlob = imgBlob.toString().substring(imgBlob.indexOf(",") + 1);
// window.saveAs(imgBlob, 'my-node.png');
let imgUrl = Canvas2Image.convertToPNG(canvas,$("#app").width(),$("#app").height()) let imgUrl = Canvas2Image.convertToPNG(canvas,$("#app").width(),$("#app").height())
console.log($(imgUrl).attr('src'))
imgUrl = $(imgUrl).attr('src') imgUrl = $(imgUrl).attr('src')
// 如果浏览器支持msSaveOrOpenBlob方法也就是使用IE浏览器的时候那么调用该方法去下载图片 // 如果浏览器支持msSaveOrOpenBlob方法也就是使用IE浏览器的时候那么调用该方法去下载图片
if (window.navigator.msSaveOrOpenBlob) { if (window.navigator.msSaveOrOpenBlob) {