尝试渲染页面时出现此错误
Uncaught (in promise) TypeError: this.getChildren is not a function
at html2canvas.js:2014
at prototype.js:298
at prototype.js:266
at Array._each (prototype.js:473)
at Array.each (prototype.js:264)
at Array.collect (prototype.js:296)
at NodeParser.getChildren (html2canvas.js:2012)
at new NodeParser (html2canvas.js:1860)
at renderWindow (html2canvas.js:1018)
at html2canvas.js:1005
这是我渲染页面的代码
var runH2c = function(){
try {
/*option.testTop = scrollValueX;
options.logging = true;
options.onrendered = options.onrendered || function( canvas ) {
};*/
var body = document.getElementsByTagName("body")[0];
window.html2canvas(body, {
logging: true,
type: 'view',
onrendered: function(canvas) {
$this.h2cCanvas = canvas;
$this.h2cDone = true;
}
})
/* window.html2canvas([ document.body ], options);*/
} catch( e ) {
$this.h2cDone = true;
log("Error in html2canvas: " + e.message);
}
};
这是html2canvas上有错误的代码
NodeParser.prototype.getChildren = function(parentContainer) {
return flatten([].filter.call(parentContainer.node.childNodes, renderableNode).map(function(node) {
var container = [node.nodeType === Node.TEXT_NODE ? new TextContainer(node, parentContainer) : new NodeContainer(node, parentContainer)].filter(nonIgnoredElement);
return node.nodeType === Node.ELEMENT_NODE && container.length && node.tagName !== "TEXTAREA" ? (container[0].isElementVisible() ? container.concat(this.getChildren(container[0])) : []) : container;
}, this));
};
html2canvas的版本是 - html2canvas 0.5.0-beta4 原型是 - 原型JavaScript框架,版本1.5.0_rc0 *(c)2005 Sam Stephenson
拜托,我需要帮助我的项目。我该怎么办?