我认为这是使用flex-grow: 1;. 希望能帮助到你
https://jsfiddle.net/BradChelly/ck72re3a/
.container {
width: 100px;
height: 150px;
background: #444;
display: flex;
flex-direction: column;
align-content: stretch;
}
.box1 {
width: 100%;
background: steelblue;
flex-grow: 1;
}
.box2 {
height: 50px;
width: 100%;
background: indianred;
}Run Code Online (Sandbox Code Playgroud)
<div class="container">
<div class="box1"></div>
<div class="box2"></div>
</div>Run Code Online (Sandbox Code Playgroud)