Phi*_*egg 7 javascript extjs extjs4
看看ExtJS 4,我试图在这里做"Hello World"教程:http: //www.sencha.com/learn/getting-started-with-ext-js-4/
我按照教程中的建议设置了所有文件:

但是,由于启动文件的时髦语法,我不断收到错误:

我没有使用JQuery或任何其他库 - 因为Sencha应该是一个完整的JavaScript环境.
这是完整的代码:
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)
的index.html
<!doctype 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)
关于什么可能是罪魁祸首的任何想法?
你不应该在JS文件中有任何HTML.教程中的代码搞砸了.这些锚点href标签是ExtJS API文档的链接,以某种方式插入到示例代码中.
实际代码应该是:
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)
我在这里提出了关于该页面的错误报告:http://www.sencha.com/forum/showthread.php? 175129-Documentation-Getting-Started-with-Ext-JS-4.0&p=717098# post717098
2012年1月21日添加:显然该教程的正确版本可从以下网址获得:http://docs.sencha.com/ext-js/4-0/#!/ guide/getting_started