【发布时间】:2018-08-12 17:11:40
【问题描述】:
使用 angular2/4,我想在单个芯片旁边使用带有文本的 mat-chip (https://material.angular.io/components/chips/overview),并让它占据每个“条目”的整个宽度(div 中的单行)。其他条目应显示在彼此下方,就像正在运行的聊天一样。现在我有:
我目前的代码如下,但是看起来并没有达到预期的效果……
<div class="rectanglebox" style="width:300px;height:500px;">
<div style="float:left">
<mat-chip-list>
<mat-chip>A</mat-chip>
</mat-chip-list>
</div>
<div style="float:left">Text for A that is really long and may overflow. If it does, the chip should remain to the left side and not move all the text to a new dedicated line.</div>
</div>
</div>
<div style="float:left">
<mat-chip-list>
<mat-chip>B</mat-chip>
</mat-chip-list>
</div>
<div style="float:left">Text for B</div>
</div>
<div style="float:left">
<mat-chip-list>
<mat-chip>C</mat-chip>
</mat-chip-list>
</div>
<div style="float:left">Text for C</div>
</div>
使用示例显示所有文本如果太长而不是环绕在芯片“下方”,则该示例如何: https://stackblitz.com/edit/angular-ijhhz3-fn56yj?file=app/chips-overview-example.html
【问题讨论】: