0

我正在关注http://www.sencha.com/learn/a-sencha-touch-mvc-application-with-phonegap/上的 SenchaTouch/PhoneGap 教程 我正处于初始化 SenchaTouch 应用程序的阶段,我的 HTML 是:

<!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↵eval@[native code]↵_evaluateOn↵↵_evaluateAndWrap↵↵evaluate↵↵[native code]"
__proto__: Error

任何建议如何解决这个问题?

4

1 回答 1

2

不应该是这样的:

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

代替Ext.regApplication

于 2013-04-04T14:13:16.030 回答