qooxdoo 错误(qx.html 未定义)

发布于 2024-11-14 20:27:53 字数 1748 浏览 4 评论 0 原文

我正在学习 qooxdoo (顺便说一句,我认为这很棒,因为我实际上理解它)。 不幸的是,在遵循 Twitter 客户端教程时,我在加载页面时遇到了错误。

创建新的类文件 MainWindow.js 后,

qx.Class.define("twitter.MainWindow",
{
    extend: qx.ui.window.Window,

    construct : function()
    {
        this.base(arguments, "Tweeter");
    }
});

我转到 Application.js 类文件并添加

var main = new twitter.MainWindow();
    main.open();

它应该让我看到小窗口。

运行generate.py source后 我在 firebug 中遇到此错误

qx.html is undefined
[Break On This Error] return new qx.html.Element("div", styles, attributes); 

我尝试使用 source-all 甚至 build 运行generate.py,但无济于事。 有人可以帮助我吗,我真的需要开始使用这个(我浪费了两天时间尝试使用卡布奇诺和 SproutCore...没用)

更新 我解决了这个问题。显然,我在应用程序类定义之外输入窗口代码。在我的辩护中,教程说“将其添加到 Application.js 文件的末尾”,

所以这


qx.Class.define("twitter.Application",
{
  extend : qx.application.Standalone,

  members :
  {
    main : function()
    {
      // Call super class
      this.base(arguments);

      // Enable logging in debug variant
      if (qx.core.Environment.get("qx.debug"))
      {
        qx.log.appender.Native;
        qx.log.appender.Console;
      }


    }
  }
});

var main = new twitter.MainWindow();
        main.open();

应该是


qx.Class.define("twitter.Application",
{
  extend : qx.application.Standalone,

  members :
  {

    main : function()
    {
      // Call super class
      this.base(arguments);

      // Enable logging in debug variant
      if (qx.core.Environment.get("qx.debug"))
      {
        qx.log.appender.Native;
        qx.log.appender.Console;
      }

      var main = new twitter.MainWindow();
        main.open();
    }
  }
});

I am learning qooxdoo (which i think is awesome btw since i actually understand it).
Unfortunately, while following the twitter client tutorial, i ran into an error when i load the page.

After creating a new class file MainWindow.js

qx.Class.define("twitter.MainWindow",
{
    extend: qx.ui.window.Window,

    construct : function()
    {
        this.base(arguments, "Tweeter");
    }
});

I go to the Application.js class file and add

var main = new twitter.MainWindow();
    main.open();

which is supposed to let me see the small window.

After running generate.py source
i get this error in firebug

qx.html is undefined
[Break On This Error] return new qx.html.Element("div", styles, attributes); 

I have tried running generate.py with source-all and even build but to no avail.
Can someone please help me, I really need to get started with this (I wasted two days trying to work with cappuccino and SproutCore... useless)

UPDATE
I solved the issue. Apparently, i was typing the window code outside the application class definition. In my defense, the tutorial said "add this to the end of the Application.js file"

so this


qx.Class.define("twitter.Application",
{
  extend : qx.application.Standalone,

  members :
  {
    main : function()
    {
      // Call super class
      this.base(arguments);

      // Enable logging in debug variant
      if (qx.core.Environment.get("qx.debug"))
      {
        qx.log.appender.Native;
        qx.log.appender.Console;
      }


    }
  }
});

var main = new twitter.MainWindow();
        main.open();

should should have been


qx.Class.define("twitter.Application",
{
  extend : qx.application.Standalone,

  members :
  {

    main : function()
    {
      // Call super class
      this.base(arguments);

      // Enable logging in debug variant
      if (qx.core.Environment.get("qx.debug"))
      {
        qx.log.appender.Native;
        qx.log.appender.Console;
      }

      var main = new twitter.MainWindow();
        main.open();
    }
  }
});

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

八巷 2024-11-21 20:27:53

很好,你自己解决了这一切:-)。是的,教程文本在这一点上不明确,我将提交一个错误来修复它。

一般来说,qooxdoo 使用“封闭形式”来定义它的类。与特定类相关的所有信息都在这个传递给 qx.Class.define 的大映射中。该手册用相当长的篇幅解释了类定义的各种元素,也许您会发现这很有帮助(参见例如 此处)。

另一方面,您首先执行的是完全合法的 JavaScript,因此您没有遇到任何会导致生成器立即退出的语法错误。不过,您应该在生成器输出中看到警告。

Very good, you solved it all by yourself :-). Yes, the tutorial text is ambiguous in this point, and I will file a bug to fix that.

In general, qooxdoo uses a "closed form" for its class definition. Every information pertaining to a specific class is in this one big map that is passed to qx.Class.define. The manual goes to some length explaining the various elements of a class definition, maybe you find that helpful (see e.g. here).

On the other hand, what you did first is perfectly legal JavaScript, so you didn't get any of the syntax errors that would cause the generator to exit right away. You should have seen a warning, though, in the generator output.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文