如何为mat-sidenav
提供100%的宽度-与mat-sidenav-container
相同的宽度(在mat-sidenav上使用[fixedInViewport]="true"
时)?
在此处查看一个stackblitz示例: https://stackblitz.com/edit/angular-sidenav-sp?file=src%2Fapp%2Fsidenav-fixed-example.html
在该示例中,您可以看到使用mat-sidenav-container
时side-nav变得比[fixedInViewport]="true"
大。 mat-sidenav具有width: 100%
,似乎占用了viewPort的宽度。
宽度确定:
宽度不正确(mat-sidenav大于mat-sidenav-容器):
[fixedInViewport]="true"
会将此CSS道具添加到mat-sidenav:position: fixed
。
因此,我担心这就是CSS的工作原理。position: fixed
元素的100%宽度占用了viewPort的100%。
也许我有解决方法?