Sencha touch:错误 - “即使文件已加载,也未声明以下类:'Ext.panel'

时间:2013-08-27 11:06:04

标签: sencha-touch-2 extjs-mvc

我刚开始使用sencha touch,对sencha文档及其原生感觉印象深刻。我正在尝试这个link。但是我之间出现了错误,我在控制台中出现了这个错误“即使他们的文件已被加载,也未声明以下类:'Ext.panel'。请检查相应文件的源代码是否存在错字:'touch / SRC / panel.js”。我是MVC框架的新手,所以我无法找到我出错的地方。 在尝试使用Sencha Touch之前,是否有必要熟悉ExtJs?

这是我的代码 App.js

Ext.Loader.setPath({
'Ext': 'touch/src'
});


Ext.application({
name: 'hello',

requires: [
'Ext.MessageBox'
],

views: [
'Main','Home'
],

icon: {
'57': 'resources/icons/Icon.png',
'72': 'resources/icons/Icon~ipad.png',
'114': 'resources/icons/Icon@2x.png',
'144': 'resources/icons/Icon~ipad@2x.png'
},

isIconPrecomposed: true,

startupImage: {
'320x460': 'resources/startup/320x460.jpg',
'640x920': 'resources/startup/640x920.png',
'768x1004': 'resources/startup/768x1004.png',
'748x1024': 'resources/startup/748x1024.png',
'1536x2008': 'resources/startup/1536x2008.png',
'1496x2048': 'resources/startup/1496x2048.png'
},

launch: function() {
// Destroy the #appLoadingIndicator element
Ext.fly('appLoadingIndicator').destroy();

// Initialize the main view
Ext.Viewport.add(Ext.create('hello.view.Main'));
},

onUpdated: function() {
Ext.Msg.confirm(
"Application Update",
"This application has just successfully been updated to the latest version. Reload,
function(buttonId) {
if (buttonId === 'yes') {
window.location.reload();
}
}
);
}
});

Main.js

Ext.define('hello.view.Main', {
extend: 'Ext.tab.Panel',
requires: [
'Ext.TitleBar'
],
config: {
tabBarPosition: 'bottom',

items: [
{
xtype:'homepanel'
}
]
}
});

Home.js

Ext.define('Hello.View.Home',{
extend:'Ext.panel',
xtype:'homepanel',
config:{
title:'Home',
iconCls:'home',

html: [
'<img src="http://staging.sencha.com/img/sencha.png" />',
'<h1>Welcome to Sencha Touch</h1>',
"<p>You're creating the Getting Started app. This demonstrates how ",
"to use tabs, lists, and forms to create a simple app</p>",
'<h2>Sencha Touch</h2>'
].join("")

}
});

的index.html

<!DOCTYPE HTML>
<html manifest="" lang="en-US">
<head>
<meta charset="UTF-8">
<title>hello</title>
<style type="text/css">

</style>
<!-- The line below must be kept intact for Sencha Command to build your application ->
<script id="microloader" type="text/javascript" src="touch/microloader/development.js">     </script>
<script type="text/javascript" src="app/view/Home.js"></script>
</head>
<body>
<div id="appLoadingIndicator">
<div></div>
<div></div>
<div></div>
</div>
</body>
</html>

1 个答案:

答案 0 :(得分:1)

正如错误所说的那样。班级名称为Ext.Panel,而不是Ext.panel