所以想象我有以下标记
<div class="container">
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
</div>
Run Code Online (Sandbox Code Playgroud)
以下款式 (SASS)
@mixin max-width($width) {
@media screen and (max-width: $width) {
@content;
}
}
.container {
display: flex;
@include max-width(992px) {
number: 4; //Hypothetical property that is supposed to control number per row
}
@include max-width(640px) {
number: 2; //Hypothetical property that is supposed to control number per row
}
}
.item {
background-color: tomato;
padding: 20px;
margin-right: …
Run Code Online (Sandbox Code Playgroud) 我试图按照这篇文章Angular flex-layout with ngFor来做我想做的事,但我做不到。
我有这个代码:
<div *ngFor="let room of listRoom;">
<div class="room">
Room {{room.label}}
<div *ngFor="let bed of room.beds;">
<div class="bed">
Bed #{{bed.label}}
<button mat-raised-button color="accent" (click)="assignThisBed(bed)">
Assign this bed
</button>
</div>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我的listRooms
元素通常在 10-15 个元素之间,我想连续有 3 个房间,然后是隔断线,3 个房间,......
有人能帮我吗?谢谢..
这是带有我的代码的StackBlitz。