问题描述
我试图将一个ST2应用程序集成到PhoneGap;但我遇到了问题。
我已将cordova.js添加到app.json中:
{
pre>
path:resources / js / cordova-1.6.1.js,
update:delta
},
{
path:resources / js / test.js,
update:delta
}
Test.js:
function alertDismissed
function showAlert(){
navigator.notification.alert(
'您是赢家!',//消息
alertDismissed,// callback
'Game Over',// title
'Done'// buttonName
);
}
在视图中创建了一个虚拟按钮:项目:[{
text:'test',
action:showAlert(),
} ,
函数'showAlert()'被正确激发;但没有正确执行我有一个错误:
未捕获TypeError:无法调用未定义的方法'alert'
显然是因为对象导航器没有安装。
问题:是可能有cordova / senchatouch2运行?
如果是,那么正确的方法是什么?
解决:
.js之前的app.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文件即可。
I'm trying to integrate a ST2 app into PhoneGap; but I'm having problems.
I've added cordova.js into app.json:
{ "path": "resources/js/cordova-1.6.1.js", "update": "delta" }, { "path": "resources/js/test.js", "update": "delta" }
Test.js :
function alertDismissed() {} function showAlert() { navigator.notification.alert( 'You are the winner!', // message alertDismissed, // callback 'Game Over', // title 'Done' // buttonName ); }
Inside a view, i've created a dummy button:
items: [{ text: 'test', action: showAlert(), }],
When i tap the button; the function 'showAlert()' is fired up correctly; but not being executed correctly i have an error :
Uncaught TypeError: Cannot call method 'alert' of undefined
Obviously because the object 'navigator' is not being instenciated.
Question: is it possible to have both cordova/senchatouch2 run ?If so, what is the proper way to do it ?
SOLVED:
Add cordova.js prior to app.js
{ "path": "resources/js/cordova-1.6.1.js", "update": "delta" }, { "path": "sdk/sencha-touch.js" }, { "path": "app.js", "update": "delta" },
解决方案Just include the cordova.js file from the index.html file.
这篇关于如何将Sencha Touch 2集成到Cordova(Phonegap)项目中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!