“核心页眉面板"开箱即用 [英] "core-header-panel" doesnt seem to work out-of-the-box
问题描述
I was trying some core
polymer elements, and I have been having trouble using core-header-panel
in my demo.
我认为工具栏是正确的,因为我设法完成了另一个演示它使用最少的CSS.但是我为core-header-panel找到的所有演示似乎都将大多数布局配置都带到了组件之外(有点像组件的要点).我在这里误解了吗?
I think the toolbar is right, because I managed to do another demo where it was working with minimal CSS. But all the demo I found for core-header-panel seems to take most of the layout configuration outside the component (Which kinda seems like the point of the component). Did I misinterpret something here?
推荐答案
当今最好的模式是使用聚合物布局属性.
The best pattern today is to use the polymer layout attributes.
<body fullbleed vertical layout>
<core-header-panel flex>
vertical layout
使主体成为一个(垂直)柔性盒,并且core-header-panel
上的flex
属性将使其填充可用空间. fullbleed
属性设置主体以适合视口.
vertical layout
makes the body a (vertical) flex-box, and the flex
attribute on the core-header-panel
will make it fill the available space. fullbleed
attribute sets body to fit the viewport.
与使用fit
相比,这通常是一种更好的模式,因为弹性盒更具弹性.您可以在正文中添加其他页眉或页脚,然后柔性面板就会适应.
This is a better pattern in general than using fit
because flex-boxes are more resilient. You could add a different header or footer to body, and the flex panel will adapt.
此外,使用layout
容器和flex
子代是一种模式,您可以继续在应用程序的其他位置使用该模式.
Also, using layout
containers and flex
children is a pattern you can continue to use in other places in the application.
这篇关于“核心页眉面板"开箱即用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!