Sencha touch 2 导航视图未正确呈现项目
视图渲染不正确。它只显示按钮。我做错了什么Sencha touch 2 导航视图未正确呈现项目,sencha-touch-2,Sencha Touch 2,视图渲染不正确。它只显示按钮。我做错了什么 Ext.application({ name: 'App', models: ['Picture'], stores: ['Pictures'], views: ['Picture'], requires: [ 'Ext.carousel.Carousel', 'Ext.data.proxy.JsonP' ], launch: function() { var titleVis
Ext.application({
name: 'App',
models: ['Picture'],
stores: ['Pictures'],
views: ['Picture'],
requires: [
'Ext.carousel.Carousel',
'Ext.data.proxy.JsonP'
],
launch: function() {
var titleVisible = false,
info, carousel;
carousel = Ext.create('Ext.Carousel', {
store: 'Pictures',
direction: 'horizontal',
listeners: {
activeitemchange: function(carousel, item) {
info.setHtml(item.getPicture().get('title'));
}
}
});
info = Ext.create('Ext.Component', {
cls: 'apod-title',
top: '50',
left: 0,
right: 0
});
var view = Ext.create('Ext.NavigationView', {
title:'Paramore',
items: [carousel,info,{xtype:'button',text:'help'}]
});
Ext.Viewport.add(view);
--- some code ----
});
}
});
.我也试过这个
var view=Ext.create('Ext.NavigationView'{
标题:"测试",,
项目:[
{
xtype:'容器',
标题:"测试",,
可滚动:“垂直”,
项目:[传送带,信息]
}您的代码存在一些问题:
存储
配置。您可以学习如何执行此操作项
是发布时项的初始堆栈
。因此,如果放入3个项,最后一个项将可见,而后退按钮将可见。当按下后退按钮时,它将删除最后一个项,并且项
堆栈中将有2个项。存储
和侦听器
的引用,您的示例将按预期工作。以下是我用来使其工作的代码。我刚刚注释了损坏的代码:
Ext.application({
name: 'App',
// models: ['Picture'],
// stores: ['Pictures'],
// views: ['Picture'],
requires: ['Ext.carousel.Carousel', 'Ext.data.proxy.JsonP'],
launch: function() {
var titleVisible = false,
info, carousel;
carousel = Ext.create('Ext.Carousel', {
// store: 'Pictures',
direction: 'horizontal',
items: [{
html: 'one'
}, {
html: 'two'
}, {
html: 'three'
}]
// listeners: {
// activeitemchange: function(carousel, item) {
// // info.setHtml(item.getPicture().get('title'));
// }
// }
});
info = Ext.create('Ext.Component', {
cls: 'apod-title',
top: '50',
left: 0,
right: 0
});
var view = Ext.create('Ext.NavigationView', {
title: 'Paramore',
items: [carousel, info,
{
xtype: 'button',
text: 'help'
}]
});
Ext.Viewport.add(view);
}
});
您的代码存在一些问题:
存储
配置。您可以学习如何执行此操作项
是发布时项的初始堆栈
。因此,如果放入3个项,最后一个项将可见,而后退按钮将可见。当按下后退按钮时,它将删除最后一个项,并且项
堆栈中将有2个项。存储
和侦听器
的引用,您的示例将按预期工作。以下是我用来使其工作的代码。我刚刚注释了损坏的代码:
Ext.application({
name: 'App',
// models: ['Picture'],
// stores: ['Pictures'],
// views: ['Picture'],
requires: ['Ext.carousel.Carousel', 'Ext.data.proxy.JsonP'],
launch: function() {
var titleVisible = false,
info, carousel;
carousel = Ext.create('Ext.Carousel', {
// store: 'Pictures',
direction: 'horizontal',
items: [{
html: 'one'
}, {
html: 'two'
}, {
html: 'three'
}]
// listeners: {
// activeitemchange: function(carousel, item) {
// // info.setHtml(item.getPicture().get('title'));
// }
// }
});
info = Ext.create('Ext.Component', {
cls: 'apod-title',
top: '50',
left: 0,
right: 0
});
var view = Ext.create('Ext.NavigationView', {
title: 'Paramore',
items: [carousel, info,
{
xtype: 'button',
text: 'help'
}]
});
Ext.Viewport.add(view);
}
});
谢谢你的帮助:-)。我不知道导航视图的行为。代码取自Ed Spencer博客,我想在导航视图中写同样的东西,并附上一个列表。那就是我想要旋转木马(就像Ed的博客一样)和导航视图中的列表。这是我在上面的代码中尝试的。再次感谢。谢谢你帮助我:-)。我不知道导航视图的行为。代码是从Ed Spencer博客中获取的,我想在导航视图中与列表一起写同样的东西。那就是我想要旋转木马(在Ed的博客中)和导航视图中的列表。这就是我在上面代码中尝试的。再次感谢。