Uncaught (in promise) Provided element is not within a Document

今天在使用html2canvas生成海报的时候,发现报了个如下图所示的错误:

发生这个错误的本质原因是在调用html2canvas的时候传递的是jQuery对象,而不是DOM原生对象

开始的时候我是按下图这么写的:

 改成如下图所示的就可以了:

 解决方法来自于:https://stackoverflow.com/questions/16396074/object-htmldivelement-as-jquery-object

原文地址:https://www.cnblogs.com/sese/p/9205058.html