2013-04-04 79 views
0

我下面的http://www.sencha.com/learn/a-sencha-touch-mvc-application-with-phonegap/ 我在初始化的SenchaTouch应用阶段的SenchaTouch/PhoneGap的教程中,我的HTML是:SenchaTouch PhoneGap Ext.regApplication不是一个函数吗?

<!DOCTYPE html><html> 
<head> 
    <title>Contacts</title> 
    <script type="text/javascript" src="lib/touch/sencha-touch.js"></script> 
    <link href="lib/touch/resources/css/sencha-touch.css" rel="stylesheet" type="text/css" /> 
    <script type="text/javascript" src="cordova-2.5.0.js"></script> 
    <script type="text/javascript" src="app/app.js"></script> 
    <script type="text/javascript" src="app/views/Viewport.js"></script> 
    <script type="text/javascript"> 
     document.addEventListener("deviceready", app.mainLaunch, false); 
     </script> 
</head><body></body></html> 

,但是当我执行:

Ext.regApplication({ 
name: 'app', 
launch: function() { 
    console.log('launch'); 
}}); 

我得到:

TypeError: 'undefined' is not a function (evaluating 'Ext.regApplication({ name: 'app', launch: function() { console.log('launch'); } })') 
line: 6 
message: "'undefined' is not a function (evaluating 'Ext.regApplication({↵ name: 'app',↵ launch: function() {↵  console.log('launch');↵ }↵})')" 
stack: "eval code↵[email protected][native code]↵_evaluateOn↵↵_evaluateAndWrap↵↵evaluate↵↵[native code]" 
__proto__: Error 

有什么建议如何解决这个问题?

回答

2

它不应该是这样的:

Ext.application({ 
    name: 'app', 
    launch: function() {} 
}); 

,而不是Ext.regApplication