Angular material design md-tab scroll content

核能气质少年 提交于 2020-01-03 18:59:14

问题


This might be a simple issue, but I'm new to this...

I am trying to have an md-tabs element that takes the entire screen, and have only the tabs' content scroll. Here is an example on jsFiddle

Any ideas? thx!


回答1:


Try this:

<body ng-cloak layout="column" ng-controller="AppController as app">
    <md-toolbar layout="row" class="md-toolbar-tools">
        <h1>Welcome!</h1>
    </md-toolbar>
    <div layout="column" flex>
        <md-tabs md-stretch-tabs="always" flex>
            <md-tab label="Tab1">
                add our larger-than-life content here
            </md-tab>
            <md-tab label="Tab2">
            </md-tab>
       </md-tabs>
    </div>
</body>

Adding the flex attribute to md-tabs will make the content of the inner tabs (md-tab) scrollable.




回答2:


Try to add this style to your div element inside md-tab :

div{    
  height: 100px; 
  overflow-y: scroll;
}

Your container must be a fixed size. Also, you can play with overflow property. Read this for more information.

Thanks




回答3:


Seems like it was a bug in 0.8.3 that is fixed now in master (commit: 74601d0)



来源:https://stackoverflow.com/questions/29229300/angular-material-design-md-tab-scroll-content

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!