1 回答

TA貢獻1871條經驗 獲得超13個贊
改下源碼:
主要是讓用戶調用時能夠自定義需要截取Dom對象的寬和高
return renderDocument(node.ownerDocument, options, node.ownerDocument.defaultView.innerWidth, node.ownerDocument.defaultView.innerHeight, index).then(function(canvas) {
? ? ? ? if (typeof(options.onrendered) === "function") {
? ? ? ? ? ? log("options.onrendered is deprecated, html2canvas returns a Promise containing the canvas");
? ? ? ? ? ? options.onrendered(canvas);
? ? ? ? }
? ? ? ? return canvas;
? ? });
改成
? ?//2016-02-18修改源碼,解決BUG 對于部分不能截屏不能全屏添加自定義寬高的參數以支持
? ? var width = options.width != null ? options.width : node.ownerDocument.defaultView.innerWidth;
? ? var height = options.height != null ? options.height : node.ownerDocument.defaultView.innerHeight;
? ? return renderDocument(node.ownerDocument, options, width, height, index).then(function (canvas) {
? ? ? ? if (typeof(options.onrendered) === "function") {
? ? ? ? ? ? log("options.onrendered is deprecated, html2canvas returns a Promise containing the canvas");
? ? ? ? ? ? options.onrendered(canvas);
? ? ? ? }
? ? ? ? return canvas;
? ? });
添加回答
舉報