2013-04-04 64 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