3

我正在尝试将 ST2 应用程序集成到 PhoneGap 中;但我遇到了问题。

我已将 cordova.js 添加到 app.json 中:

{   
    "path": "resources/js/cordova-1.6.1.js",
    "update": "delta"
},
{   
    "path": "resources/js/test.js",
    "update": "delta"
}

测试.js:

function alertDismissed() {}

function showAlert() {
    navigator.notification.alert(
        'You are the winner!',  // message
        alertDismissed,         // callback
        'Game Over',            // title
        'Done'                  // buttonName
    );
}

在视图中,我创建了一个虚拟按钮:

items: [{
    text: 'test',
    action: showAlert(),
}],

当我点击按钮时;函数“showAlert()”被正确启动;但没有正确执行我有一个错误:

Uncaught TypeError: Cannot call method 'alert' of undefined

显然是因为对象“导航器”没有被执行。

问题:是否可以同时运行 cordova/senchatouch2 ?如果是这样,正确的方法是什么?

解决了:

在 app.js 之前添加 cordova.js

    {   
        "path": "resources/js/cordova-1.6.1.js",
        "update": "delta"
    },
    {
        "path": "sdk/sencha-touch.js"
    },
    {
        "path": "app.js",
        "update": "delta"
    },
4

3 回答 3

3

只需包含 index.html 文件中的 cordova.js 文件。

于 2012-04-30T13:37:40.133 回答
1

这是一篇关于“带有 PhoneGap 的 Sencha Touch MVC 应用程序”的好文章http://www.sencha.com/learn/a-sencha-touch-mvc-application-with-phonegap/

于 2012-07-24T02:46:24.480 回答
0

您可以参考以下博客将 senchatouch 和 phonegap 与自定义插件集成:

http://hynridmobileapps.blogspot.in/

于 2014-04-10T05:47:11.377 回答