我有一个Angular项目,其中有两个工具栏:第一个是整个应用程序的固定工具栏。我把这段代码放在一个组件的工具条里面。
<-- toolbar.component.css-->
mat-toolbar {
position: fixed;
justify-content: space-between;
align-items: center;
top: 0;
z-index: 1000;
}
<--toolbar.component.html-->
<mat-toolbar>
...
</mat-toolbar>
第二个工具条在另一个组件里面。
<--component.css-->
mat-toolbar {
position: relative;
justify-content: space-between;
align-items: center;
}
<--component.html-->
<mat-toolbar color="primary">
...
</mat-toolbar>
我的问题是第二个工具条没有被渲染出来 第二个工具条应该在固定工具条之后被渲染出来
我在app.component.html中调用了这两个组件。
谁能帮我解决这个问题?
在浏览器中检查你的开发者控制台。如果它有一些错误,它可能没有渲染。同时检查你的第二个组件中是否有任何*ngIf或隐藏。如果一切都很完美,那么检查元素并检查该组件是否被加载。