qooxdoo 错误(qx.html 未定义)
我正在学习 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();
}
}
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
很好,你自己解决了这一切:-)。是的,教程文本在这一点上不明确,我将提交一个错误来修复它。
一般来说,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.