简体   繁体   English

Sencha Touch 2 - 标签面板中的旋转木马

[英]Sencha Touch 2 - Carousel in Tabbed Panel

I want to have view in which a 2 v-boxes are in two different tabs. 我希望有一个视图,其中2个v-box位于两个不同的选项卡中。 My code shows no error, but the only thing that shows in a tabbed-panel without tabs. 我的代码显示没有错误,但唯一的东西显示在没有选项卡的选项卡式面板中。 You can see that partially edited out the tutorial Carousel with some copies of the same class, but ignore that. 您可以看到部分编辑了教程Carousel与同一类的一些副本,但忽略它。

Ext.define("caryhartline.view.Carousel", {
    extend : 'Ext.tab.Panel',
    requires : ['Ext.carousel.Carousel'],
    config : [{
        tabBarPosition : 'top',
        items : [{
            title : 'Business',
            iconCls : 'action',
            layout : 'card',
            config : [{
                cls : 'cards',
                layout : {
                    type : 'vbox',
                    align : 'stretch'
                },
                defaults : {
                    flex : 1
                },
                items : [{
                            xtype : 'carousel',
                            items : [{
                                        html : '',
                                        cls : 'card businesstemplatepicture'
                                    }, {
                                        html : '',
                                        cls : 'card businesstemplatepicture'
                                    }]
                        }, {
                            xtype : 'carousel',
                            ui : 'light',
                            direction : 'vertical',
                            items : [{
                                        html : '',
                                        cls : 'card dark businesstemplate2picture'
                                    }, {
                                        html : 'And can also use <code>ui:light</code>.',
                                        cls : 'card dark'
                                    }, {
                                        html : 'Card #3',
                                        cls : 'card dark'
                                    }]
                        }]
            }]
        }]
    }, {
        title : 'Minimalist',
        iconCls : 'action',
        layout : 'card',
        config : {
            cls : 'cards',
            layout : {
                type : 'vbox',
                align : 'stretch'
            },
            defaults : {
                flex : 1
            },
            items : [{
                        xtype : 'carousel',
                        items : [{
                                    html : '',
                                    cls : 'card businesstemplatepicture'
                                }, {
                                    html : '',
                                    cls : 'card businesstemplatepicture'
                                }]
                    }, {
                        xtype : 'carousel',
                        ui : 'light',
                        direction : 'vertical',
                        items : [{
                                    html : '',
                                    cls : 'card dark businesstemplate2picture'
                                }, {
                                    html : 'And can also use <code>ui:light</code>.',
                                    cls : 'card dark'
                                }, {
                                    html : 'Card #3',
                                    cls : 'card dark'
                                }]
                    }]
        }
    }]
});

For some reason putting things inside the config is causing the issue. 出于某种原因,将内容放入配置中会导致问题。 Not sure what is wrong. 不确定有什么问题。 I think when we cant use nested configs in class definition. 我想当我们不能在类定义中使用嵌套配置时。 But this should work 但这应该有效

Ext.define("App.view.Carousel", {
    extend : 'Ext.tab.Panel',
    requires : ['Ext.carousel.Carousel'],
    config : {
        tabBarPosition : 'top',
        items : [{
            title : 'Business',
            iconCls : 'action',
            cls : 'cards',
            layout : {
                type : 'vbox',
                align : 'stretch'
            },
            defaults : {
                flex : 1
            },
            items : [{
                xtype : 'carousel',
                items : [{
                    html : 'Test 1',
                    cls : 'card businesstemplatepicture'
                }, {
                    html : 'Test 2',
                    cls : 'card businesstemplatepicture'
                }]
            }, {
                xtype : 'carousel',
                ui : 'light',
                direction : 'vertical',
                items : [{
                    html : 'Test 3',
                    cls : 'card dark businesstemplate2picture'
                }, {
                    html : 'And can also use <code>ui:light</code>.',
                    cls : 'card dark'
                }, {
                    html : 'Card #3',
                    cls : 'card dark'
                }]
            }]
        }, {
            title : 'Minimalist',
            iconCls : 'action',
            xtype:'panel',            
            layout:'vbox',
            defaults:{
                flex:1
            },
            items:[{
                xtype : 'carousel',
                direction:'vertical',
                items:[
                    {
                        style:'background-color:blue;'
                    },
                    {
                        style:'background-color:red;'
                    }
                ]
            },{
                xtype : 'carousel',
                direction:'horizontal',
                items:[
                    {
                        style:'background-color:green;'
                    },
                    {
                        style:'background-color:orange;'
                    }
                ]
                }
            ]
        }]
    }
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM