简体   繁体   English

Sencha Touch 2-将轮播添加到面板

[英]Sencha Touch 2 - Add Carousel to Panel

I'm trying to add a carousel to a Panel view, which has several sub-panels inside. 我正在尝试将旋转木马添加到“面板”视图中,该视图内部具有多个子面板。 When I run the code though I can't see anything from the carousel. 当我运行代码时,虽然看不到轮播中的任何内容。 The other panels appear just fine. 其他面板看起来很好。 Here's the code I've got now 这是我现在得到的代码

Ext.define('app.view.HeroDetail', {
extend: 'Ext.Panel',
requires: ['Ext.Carousel'],
xtype: 'herodetail',
layout: 'vbox',
fullscreen: true,

config: {

items: [
    {
        xtype: 'panel',
        html: 'first panel',
        flex: 1
    },

    {
        xtype: 'carousel',
        items: [
            {
                xtype: 'panel',
                html: 'carousel1'
            },
            {
                xtype: 'panel',
                html: 'carousel2'
            }
        ],
        flex: 1
    },

    {
        xtype: 'panel',
        html: 'second panel',
        flex: 1
    }
]

}
});

What am I missing here? 我在这里想念什么?

Try this code. 试试这个代码。 This is working for me. 这对我有用。 Defines layout:'vbox' inside config. 在配置中定义布局:“ vbox”

            Ext.define('app.view.HeroDetail', {
            extend: 'Ext.Panel',
            requires: ['Ext.Carousel'],
            xtype: 'camerapanel',
            fullscreen: true,
            config: {
            layout: 'vbox', //defines layout inside config
            items: [
                {
                    xtype: 'panel',
                    html: 'first panel',
                    flex: 1
                },

                {
                    xtype: 'carousel',
                    flex: 1,
                    items: [
                        {
                            xtype: 'panel',
                            html: 'carousel1'
                        },
                        {
                            xtype: 'panel',
                            html: 'carousel2'
                        }
                    ]

                },

                {
                    xtype: 'panel',
                    html: 'second panel',
                    flex: 1
                }
            ]

            }
            });

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

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