我已经使用 sencha 创建了示例 Blackberry WebWorks 项目。它工作正常。代码是:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" id="viewport" content="width=device-width,height=device-height,initial-scale=1.0,user-scalable=no">
<title>Hello World</title>
<script src="www/sencha.js" type="text/javascript"></script>
<script src="www/cordova2.js" type="text/javascript"></script>
<link href="www/resources/css/app.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
new Ext.application({
launch: function () {
Ext.create('Ext.Panel', {
fullscreen: true,
items: [
{
dock : 'top',
xtype: 'toolbar',
title: 'My First Test App',
height:40
},
{
xtype : 'panel',
html:"test"
}
]
});
}
});
</script>
</head>
<body></body>
</html>
在这个项目中,我在这个文件中定义了 sencha 代码。但是现在我想创建一个项目,这样 sencha 代码应该在单独的文件中。但我得到白屏。
谁能告诉我该怎么做?
我试过这个:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" id="viewport" content="width=device-width,height=device-height,initial-scale=1.0,user-scalable=no">
<title>Hello World</title>
<script src="www/sencha.js" type="text/javascript"></script>
<script src="www/cordova2.js" type="text/javascript"></script>
<script src="www/app.js" type="text/javascript"></script>
<link href="www/resources/css/app.css" rel="stylesheet" type="text/css" />
</head>
<body></body>
</html>
app.js 代码是:
Ext.application({
name: 'SenchaDemo',
requires: [
'Ext.MessageBox'
],
views: ['SettingPanel'],
launch: function() {
// Initialize the setting view
Ext.Viewport.add(Ext.create('SenchaDemo.view.SettingPanel'));
},
onUpdated: function() {
Ext.Msg.confirm(
"Application Update",
"This application has just successfully been updated to the latest version. Reload now?",
function(buttonId) {
if(buttonId === 'yes') {
window.location.reload();
}
}
);
}
});