未捕获的引用错误:X 未定义

发布于 2024-11-24 03:00:06 字数 1353 浏览 2 评论 0原文

因此,我正在深入研究 WebOS enyo 框架,但感到非常沮丧。目前我的日志中出现以下错误。我一直在查看框架中的示例,但似乎无法找到错误的根源。我已经有十多年没有做过任何 HTML 或 js 了,当时我所做的都是非常基本的东西。任何帮助将不胜感激

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

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

Index.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>

Learning.js

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

dependent.js

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

以及

appinfo.json

文件

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

So I am digging through the WebOS enyo framework and am getting very frustrated. I am currently getting the following error in my log. I have been looking at the samples in the framework and I just can't seem to find where the error is stemming from. It's been over a decade since I have done any HTML or js and what I did back then was very basic stuff. Any help would be appreciated

Uncaught ReferenceError: Learning is not defined, index.html:9

Here is the very simple application, I am currently just attempting to get elements to appear on screen.

Index.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>

Learning.js

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

depends.js

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

and just for the heck of it the

appinfo.json

file

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

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

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

发布评论

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

评论(3

追风人 2024-12-01 03:00:06

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

您将 id 保存为:com.myapps.learning

但您将其引用为 myapps.learning,请尝试删除 com . 来自 appinfo.json 或将其添加到您的种类定义和 index.html 中

I think this is a problem in your appinfo.json file...

You hold the id as: com.myapps.learning

Yet you reference it as myapps.learning, try either removing the com. from appinfo.json or adding it to your kind definition and your index.html

゛时过境迁 2024-12-01 03:00:06

当您的 Learning.js 出现问题时,通常会出现这种情况。
我不确定,但你可以尝试:

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

This usually appears when you got something wrong in your Learning.js.
I am not quiet sure, but you could try:

enyo.kind({
    name: "MyApps.Learning",
    kind: enyo.VFlexBox,
    components: [
        {kind: "Scrim",
         layoutKind: "VFlexLayout",
         align: "center",
         pack: "center",
         components: [
                {kind: "SpinnerLarge"}
            ]
        }
    ]
});
¢蛋碎的人ぎ生 2024-12-01 03:00:06

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

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

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

In my experience, this problem occurs when the path to enyo.js is wrong. I had an older copy of the SDK/emulator, so enyo.js was not found at the path I had copied from the tutorial. Upgrading the SDK fixed it for me, but you can probably ssh into your emulator to find the correct path.

if enyo is not loaded, it won't be able to created any kinds (MyApps.Learning) you've created.

I was kind of disappointed that there were no errors logged when enyo was not found or didn't load....

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