javascript 为什么 html2canvas 没有定义?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18232225/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why is html2canvas not defined?
提问by r.r
If I'm calling this function, getting always "html2canvas is not defined".
如果我调用这个函数,总是“未定义 html2canvas”。
makeScreenshot: function(button)
{
debugger;
html2canvas(document.body, {
Uncaught ReferenceError: html2canvas is not defined
onrendered: function(canvas) {
document.body.appendChild(canvas);
}
});
},
but why? I have a class of it... like in tutorialwritten about it. Does anyone have a solution?
但为什么?我有一类它......就像在关于它的教程中一样。有没有人有办法解决吗?
I suppose I need to include html2canvas here, but I don't know how.
我想我需要在这里包含 html2canvas,但我不知道如何。
Ext.define("TEST.controller.Desktop", {
extend: "Ext.app.Controller",
views: [
"desktop.Desktop",
//"desktop.TaskBar",
"desktop.Toolbar",
"desktop.DataprovidersDataView",
"configuration.UploadFileWindow"
],
refs: [{
ref: "viewport",
selector: "viewport"
}, {
采纳答案by Evan Trimboli
Ext doesn't know anything about classes not defined as part of it's class system, you need to include the JS file using a script tag in your html.
Ext 对未定义为类系统一部分的类一无所知,您需要在 html 中使用脚本标记包含 JS 文件。
回答by jayant kamthane
You need to include required library, in my case:
您需要包含所需的库,就我而言:
- plugins\export\libs\blob
- plugins\export\libs\classList
- plugins\export\libs\blob\fabric.js
- plugins\export\libs\blob\jszip
- plugins\export\libs\blob\pdfmake
- plugins\export\libs\blob\xlsx
- 插件\导出\库\blob
- 插件\导出\库\类列表
- 插件\导出\库\blob\fabric.js
- 插件\导出\库\blob\jszip
- 插件\导出\库\blob\pdfmake
- 插件\导出\库\blob\xlsx