1

我正在学习 qooxdoo(我认为这很棒,因为我真的理解它)。不幸的是,在遵循 twitter 客户端教程时,我在加载页面时遇到了错误。

创建新的类文件后 MainWindow.js

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

    构造:函数()
    {
        this.base(arguments, "Tweeter");
    }
});

我去 Application.js 类文件并添加

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

这应该让我看到小窗户。

运行后generate.py source 我在萤火虫中得到这个错误

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

我尝试过运行generate.py,source-all甚至build没有成功。有人可以帮我吗,我真的需要开始做这个(我浪费了两天时间尝试使用卡布奇诺和 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();
    }
  }
});

4

1 回答 1

2

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

一般来说,qooxdoo 对其类定义使用“封闭形式”。与特定类有关的每个信息都在传递给的这张大地图中qx.Class.define。该手册详细解释了类定义的各种元素,也许您会觉得这很有帮助(参见例如此处)。

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

于 2011-06-11T11:14:42.430 回答