我对sencha touch 2绝对不熟悉。 我正在学习一些教程,并添加了一个视图框。但经过几次尝试注意到浏览器屏幕上显示。只有默认的sencha触摸布局。
我安装了sencha touch 2.3.1版本。除app.js和/view/main.js
外,所有文件均未被触及以下是app.js中的内容
Ext.application({
name: 'sView',
views: [
'Main'
],
launch: function() {
// Destroy the #appLoadingIndicator element
Ext.fly('appLoadingIndicator').destroy();
// Initialize the main view
Ext.Viewport.add(Ext.create('sView.view.Main'));
}
});
这是Main.js
Ext.define('sView.view.Main', {
extend: 'Ext.Panel',
xtype: 'main',
requires: [
'Ext.TitleBar'
],
config: {
config: 'vbox',
items: [{
style: 'background: #999999',
flex: 1
} {
style: 'background: #666666',
flex: 1
}]
}
});
为了清楚起见,这里的内容是 index.html
<!DOCTYPE HTML>
<html manifest="" lang="en-US">
<head>
<meta charset="UTF-8">
<title>sView</title>
<style type="text/css">
/**
* Example of an initial loading indicator.
* It is recommended to keep this as minimal as possible to provide instant feedback
* while other resources are still being loaded for the first time
*/
html, body {
height: 100%;
background-color: #1985D0
}
#appLoadingIndicator {
position: absolute;
top: 50%;
margin-top: -15px;
text-align: center;
width: 100%;
height: 30px;
-webkit-animation-name: appLoadingIndicator;
-webkit-animation-duration: 0.5s;
-webkit-animation-iteration-count: infinite;
-webkit-animation-direction: linear;
}
#appLoadingIndicator > * {
background-color: #FFFFFF;
display: inline-block;
height: 30px;
-webkit-border-radius: 15px;
margin: 0 5px;
width: 30px;
opacity: 0.8;
}
@-webkit-keyframes appLoadingIndicator{
0% {
opacity: 0.8
}
50% {
opacity: 0
}
100% {
opacity: 0.8
}
}
</style>
<!-- The line below must be kept intact for Sencha Command to build your application -->
<script id="microloader" type="text/javascript" src=".sencha/app/microloader/development.js"></script>
</head>
<body>
<div id="appLoadingIndicator">
<div></div>
<div></div>
<div></div>
</div>
</body>
</html>
答案 0 :(得分:0)
我在您的代码中看到可能产生问题的一些问题,您的sView配置需要更改为以下内容:
config: {
layout: 'vbox', //<-- The property is layout, not config
fullscreen: true, //<-- Make sure the view is set to fullscreen
items: [{
style: 'background: #999999',
flex: 1
},{ //<-- you were missing a comma between your items
style: 'background: #666666',
flex: 1
}]
}