Sencha Touch中的嵌套面板/工具栏

Mat*_*rym 1 javascript mobile extjs sencha-touch

我正在尝试创建一个恒定的底部工具栏,它控制着它上面的面板.然后它上面的面板应该有一个自己的工具栏(在顶部).我尝试了下面的代码,几乎可以工作,但我看不到子页内部面板的html.我认为这是因为面板没有占用剩余高度,但我不知道为什么.

有人有主意吗?谢谢!

Ext.setup({
    onReady: function() {


    // Sub-page sections
    var blah = {
        style: "background-color: #B22222; color:#FF0000;",
        title: "one",
        html: "Why can't I see this html",
        layout:"fit",
        flex: 1
    };
    var blah2 = {
        style: "background-color: #404040; color:#000000;",
        title: "one",
        html: "Why can't I see this html",
        layout:"fit",
        flex: 1
    };  

    // Main portion of the page, which includes top toolbar and content
    var page1 = new Ext.TabPanel({
        dock: "bottom",
        layout: "card",
        items: [blah, blah2, blah],
        title: "one",
        flex: 1
    });

    // This is the outer panel with the bottom toolbar
    var wrapper = new Ext.Panel({
        fullscreen: true,
        items: page1,
        dockedItems: [
          {
            xtype: "toolbar",
            dock: "bottom",
            items: [
              {
                iconMask: true,
                iconCls: "download"
              },
              {
                iconMask: true,
                iconCls: "favorites"
              },
              {
                iconMask: true,
                iconCls: "search"
              },
              {
                iconMask: true,
                iconCls: "user"
              }
            ]  
          }
        ]
      });
    }
});
Run Code Online (Sandbox Code Playgroud)

nel*_*rom 8

听起来你正在尝试做的事情可以使用TabPanel而不是工具栏来完成.将tabBar停靠到底部时,每个tabButton都可以接受一个图标.

我可能误解了你想要做的事,但这应该有所帮助:

Ext.setup({
    onReady: function() {


        // Sub-page sections
        var blah = {
            style: "background-color: #B22222; color:#FF0000;",
            title: "one",
            html: "Why can't I see this html",
        };
        var blah2 = {
            style: "background-color: #404040; color:#000000;",
            title: "one",
            html: "Why can't I see this html",
        };  

        // Main portion of the page, which includes top toolbar and content
        var page1 = new Ext.TabPanel({
            items: [blah, blah2, blah],
            title: "one",
            iconMask: true,
            iconCls: "download",
        });

        // This is the outer panel with the bottom toolbar
        var wrapper = new Ext.TabPanel({
            fullscreen: true,
            tabBar: {
                dock: 'bottom',
                layout: {
                    pack: 'center'
                }
            },
            items: [
                page1,
                {
                    iconMask: true,
                    iconCls: "favorites"
                },
                {
                    iconMask: true,
                    iconCls: "search"
                },
                {
                    iconMask: true,
                    iconCls: "user"
                }
            ]
        });
    }
});
Run Code Online (Sandbox Code Playgroud)

我制作了一个关于使用制表符和工具栏在sencha touch中构建用户界面的截屏视频.有一个现场演示,代码在github上,所以请随意使用它作为参考.