0

我在使用 Sencha Touch Framework 的 Carousel 组件时遇到问题。我有一个从简单面板扩展的组件,它执行以下操作:

    var cardItems = [];

    this.basicCard = new Ext.Component({
        scroll: 'vertical',
        html: 'Hello Carousel 1!'
    });

    this.basicCard2 = new Ext.Component({
        scroll: 'vertical',
        html: 'Hello Carousel 2!'
    });

    cardItems.push(this.basicCard);

    cardItems.push(this.basicCard2);

    this.carousel = new Ext.Carousel({
        items: cardItems
    });

    this.items = [this.carousel];

不幸的是,当我使这个面板可见时,轮播的内容没有显示出来,尽管我可以使用浏览器的开发人员工具看到生成的标签。

官方 Carousel 演示在我的浏览器中运行良好,如果我用面板替换 Carousel,它的内容也是可见的,所以其余代码应该是正确的。你能帮我解决这个问题吗?

4

2 回答 2

1

我不知道您面临的真正问题是什么,但它不应该出现在您发布的代码中。因为我刚刚在jsfiddle.net/r423w上进行了测试,并且您的代码可以正常工作(甚至隐藏面板并在一秒钟后显示它)。

于 2010-09-20T23:41:03.920 回答
0

我建议您将轮播卡片内容放在面板中。

this.cardItems = [];
this.cardItems.push(new Ext.Panel({
            styleHtmlContent: true,
            html: "Your HTML here"
        }));

完成推卡后,请执行以下操作

this.carousel.add(this.cardItems);
this.carousel.doLayout();
this.doLayout();

我知道轮播组件很难弄清楚,因为我也花了几个小时在它上面,但我相信当你更加努力时你会管理的。

于 2011-11-01T09:37:57.180 回答