简体   繁体   English

带有浏览器的html2canvas无法正常工作

[英]html2canvas with browserify doesn't work

I tested the html2canvas as a regular script and it seemed to be working fine. 我将html2canvas作为常规脚本进行了测试,它似乎运行良好。 Now I thought to use the npm-package and it just seems very uncooperative. 现在我想使用npm-package,它看起来非常不合作。 By another words, it won't do a thing, or never fires the then -function. 换句话说,它不会做任何事情,或者永远不会触发then函数。

The Installed package: v0.5.0-alpha2 已安装的软件包:v0.5.0-alpha2

Any ideas what to do? 有什么想法怎么办?

 var html2canvas = require('html2canvas'); html2canvas(document.body).then(function(canvas) { debugger; document.body.appendChild(canvas); }); 

Try this 尝试这个

 var html2canvas = require('html2canvas');
 window.html2canvas = html2canvas;
 html2canvas(document.body)
 .then(function(canvas) {
   debugger;
 });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM