0

嗨,我如何使用工具栏创建轮播,希望可以选择点击以切换视图并滑动以切换视图,这是我的代码,当我运行此代码时,工具栏中的 xtypes 未显示在工具栏中?

谢谢

Ext.define("NF.view.tablet.MainH", {
   extend: 'Ext.tab.Panel',
   requires: ['Ext.TitleBar'],


   config: {
   tabBar: {
      hidden: true},    

    items: [

    {
        xtype : 'toolbar',
        docked: 'top',
        title: '',
        layout:'hbox',
        items:[ 

               {xtype: 'home'} ,
               {xtype:'tablet-placesContainer'},
                {xtype:'tablet-About'},
               {text: 'contact'},
               { xtype: 'contactpage'},
                {xtype: 'home3'} ,
               ],

    },  



    {
    xtype:'carousel',
    layout:'fit',
    iconCls: 'home',
        items:[

        {xtype: 'home'} ,

        {xtype:'tablet-placesContainer'},

        {xtype:'tablet-About'},

        {xtype: 'gallery'},

        { xtype: 'contactpage'},

        {xtype: 'home3'} ,

        ]
   }]
   }

});

    When I run this the toolbar info is not showing up.    
4

1 回答 1

1

我可能误解了你的问题,但也许你最好的选择是

1)使每个工具栏项成为一个简单的按钮,带有html作为轮播项的名称

2) 给轮播命名

3) 为每个设置正确活动项的工具栏项设置一个点击事件:

Ext.define("NF.view.tablet.MainH", {
   extend: 'Ext.tab.Panel',
   requires: ['Ext.TitleBar'],


   config: {
   tabBar: {
      hidden: true},    

items: [

{
    xtype : 'toolbar',
    docked: 'top',
    title: '',
    layout:'hbox',
    items:[ 

           {xtype:'button',text: 'home', handler:function(){Ext.getCmp('carousel_name').setActiveItem(0)}} ,
           {xtype:'button',text: 'places', handler:function(){Ext.getCmp('carousel_name').setActiveItem(1)}} ,
           ],

},  



{
xtype:'carousel',
id:'carousel_name',
layout:'fit',
iconCls: 'home',
    items:[

    {xtype: 'home'} ,

    {xtype:'tablet-placesContainer'},

    {xtype:'tablet-About'},

    {xtype: 'gallery'},

    { xtype: 'contactpage'},

    {xtype: 'home3'} ,

    ]

}] }

于 2013-02-01T23:42:26.773 回答