简体   繁体   English

角度材料布局-如何创建可滚动的部分

[英]Angular Material Layout - How to create scrollable sections

I would like to use only material directives as much as possible instead of introducing some raw CSS stuff. 我想尽可能地只使用Material指令,而不是引入一些原始CSS东西。

I try to build a layout for one-page application that takes up the whole view port. 我尝试为占用整个视图端口的一页应用程序构建布局。 This is a rough sketch of the layout: 这是布局的草图:

+-------------------------------+
| Toolbar                       |
|----------+--------------------|
| Nav-Bar  | +----------------+ |
| +------+ | |                | |
| | List | | |                | |
| |      | | | un-scrollable  | |
| |      | | |     content    | |
| +------+ | | (fills         | |
| +------+ | | available area)| |
| | List | | |                | |
| |      | | |                | |
| +------+ | +----------------+ |
+----------+--------------------+

The navigation bar should remain with fixed height, and the lists should be scrollable. 导航栏应保持固定高度,并且列表应可滚动。

The different sections are components implemented as angular directives (and templates). 不同的部分是实现为角度指令(和模板)的组件。 One of the issues is that composing the app in this way seems to break the layout css set by material's directives for me. 问题之一是,以这种方式编写应用程序似乎破坏了Material指令为我设置的布局CSS。

Any help will be greatly appreciated. 任何帮助将不胜感激。

I managed eventually to solve this using this workaround . 我最终设法使用此变通办法解决了这个问题。 It seems that md-content has issues with being stretched vertically in a column layout. 似乎md-content在列布局中垂直拉伸时存在问题。

Another important point to notice is to make sure to define a layout on all the elements in the relevant hierarchy starting from body. 注意的另一个重要点是,确保从主体开始在相关层次结构中的所有元素上定义布局。

Hope this helps someone else too. 希望这也能帮助其他人。

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

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