gpt4 book ai didi

cordova - 如何将 Sencha Touch 2 集成到 Cordova (Phonegap) 项目中

转载 作者:行者123 更新时间:2023-12-02 15:47:37 25 4
gpt4 key购买 nike

我正在尝试将 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
);
}

在 View 内,我创建了一个虚拟按钮:

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

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

Uncaught TypeError: Cannot call method 'alert' of undefined

显然是因为对象“navigator”没有被强化。

问题:是否可以同时运行 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"
},

最佳答案

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

关于cordova - 如何将 Sencha Touch 2 集成到 Cordova (Phonegap) 项目中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10384596/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com