Ext JS应用程序显示空白页面

use*_*382 1 javascript extjs google-chrome-devtools

我是Ext JS的新手.我正在创建本教程中解释的第一个应用程序:http://www.sencha.com/learn/getting-started-with-ext-js-4并且如我所述,我创建了index.html,其中包含以下内容:

<html>
<head>
   <title>Hello Ext</title>

   <link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css">
   <script type="text/javascript" src="extjs/ext-debug.js"></script>
   <script type="text/javascript" src="app.js"></script>
</head>
<body></body>
</html>
Run Code Online (Sandbox Code Playgroud)

和app.js以下代码:

<a href="#!/api/Ext-method-application" rel="Ext-method-application"     class="docClass">Ext.application</a>({
name: 'HelloExt',
launch: function() {
    <a href="#!/api/Ext-method-create" rel="Ext-method-create"  class="docClass">Ext.create</a>('<a href="#!/api/Ext.container.Viewport"  rel="Ext.container.Viewport" class="docClass">Ext.container.Viewport</a>', {
        layout: 'fit',
        items: [
            {
                title: 'Hello Ext',
                html : 'Hello! Welcome to Ext JS.'
            }
        ]
    });
}
});
Run Code Online (Sandbox Code Playgroud)

但它显示了我的空白页面.如果我使用Chrome开发人员工具对其进行调试,则会向我显示以下错误:未捕获的SyntaxError:意外的令牌<在app.js中:1

我努力了但不知道app.js出了什么问题

我确信我的框架已正确设置并正常工作,但加载时页面为空白.

谢谢.

Mun*_*ter 5

使用真正的Javascript而不是错误地复制/粘贴html包装的javascript文本,你可能会有更好的运气:

Ext.application({
    name: 'HelloExt',
    launch: function() {
        Ext.create('Ext.container.Viewport', {
            layout: 'fit',
            items: [
                {
                    title: 'Hello Ext',
                    html : 'Hello! Welcome to Ext JS.'
                }
            ]
        });
    }
});
Run Code Online (Sandbox Code Playgroud)