1

所以我正在研究 WebOS enyo 框架并且非常沮丧。我目前在我的日志中收到以下错误。我一直在查看框架中的示例,但似乎无法找到错误的根源。自从我做任何 HTML 或 js 以来已经十多年了,那时我所做的只是非常基本的东西。任何帮助,将不胜感激

未捕获的 ReferenceError:未定义学习,index.html:9

这是一个非常简单的应用程序,我目前只是试图让元素出现在屏幕上。

索引.html

<!doctype html />
<html>
<head>
    <title>Learning</title>
    <script src="../../enyo/1.0/framework/enyo.js" type="text/javascript"></script>
</head>
<body>
    <script type="text/javascript">
       new MyApps.Learning().renderInto(document.body);
</script>
</body>
</html>

学习.js

enyo.kind({
    name: "MyApps.Learning",
    kind: enyo.VFlexBox,
    components: [
        { kind: "Scrim",
            layoutKind: "VFlexLayout",
            align: "center",
            pack: "center",
            components: [
                {kind: "SpinnerLarge"}
            ]
        }
    ]
});

依赖.js

enyo.depends(
    "source/Learning.js",
    "css/Learning.css"
);

只是为了它

应用信息.json

文件

{
    "id": "com.myapps.learning",
    "uiRevision": "2",
    "version": "1.0.0",
    "vendor": "kizelli",
    "type": "web",
    "main": "index.html",
    "title": "Learning"
}
4

3 回答 3

1

我认为这是您的 appinfo.json 文件中的问题...

您持有 id 为:com.myapps.learning

然而,您将其引用为 myapps.learning,尝试com.从 appinfo.json 中删除或将其添加到您的类型定义和 index.html

于 2011-07-13T19:43:18.037 回答
0

这通常在您的 Learning.js 出现问题时出现。我不确定,但您可以尝试:

enyo.kind({
    name: "MyApps.Learning",
    kind: enyo.VFlexBox,
    components: [
        {kind: "Scrim",
         layoutKind: "VFlexLayout",
         align: "center",
         pack: "center",
         components: [
                {kind: "SpinnerLarge"}
            ]
        }
    ]
});
于 2011-07-13T16:42:07.820 回答
0

根据我的经验,当 enyo.js 的路径错误时会出现此问题。我有一个较旧的 SDK/模拟器副本,因此在我从教程中复制的路径中找不到 enyo.js。升级 SDK 为我修复了它,但您可能可以通过 ssh 进入您的模拟器以找到正确的路径。

如果未加载 enyo,它将无法创建您创建的任何类型(MyApps.Learning)。

当找不到或未加载 enyo 时没有记录任何错误,我有点失望....

于 2011-07-23T15:33:32.500 回答