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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 11:08:42  来源:igfitidea点击:

Why is html2canvas not defined?

javascriptextjsextjs4html2canvas

提问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:

您需要包含所需的库,就我而言:

  1. plugins\export\libs\blob
  2. plugins\export\libs\classList
  3. plugins\export\libs\blob\fabric.js
  4. plugins\export\libs\blob\jszip
  5. plugins\export\libs\blob\pdfmake
  6. plugins\export\libs\blob\xlsx
  1. 插件\导出\库\blob
  2. 插件\导出\库\类列表
  3. 插件\导出\库\blob\fabric.js
  4. 插件\导出\库\blob\jszip
  5. 插件\导出\库\blob\pdfmake
  6. 插件\导出\库\blob\xlsx