[英]Mat Chip List opon selection expands input
Giving the default behavior, when value is selected from a dropdown, MatChip appears within the input, but also expands it.给出默认行为,当从下拉列表中选择值时,MatChip 出现在输入中,但也会扩展它。 I am a bit surprised this is the default behavior.
我有点惊讶这是默认行为。 Anyone can suggest how they fix it?
任何人都可以建议他们如何解决它? Providing a forked StackBlitz demo (source take from Angular Material documentation):
提供分叉的 StackBlitz 演示(源代码来自 Angular 材料文档):
You can see in the images bellow - when chip selected, input becomes taller.您可以在图像中看到bellow-选择芯片时,输入变高。
The problem is mat-form-field-infix
class. When there are chips in the input, they increase the height.问题是
mat-form-field-infix
class。当输入中有芯片时,它们会增加高度。
You can set the minimal height for that class to be the same as when there are chips in the input.您可以将 class 的最小高度设置为与输入中有筹码时的高度相同。 You can do it in the CSS file like this:
你可以在 CSS 文件中这样做:
::ng-deep .mat-form-field-infix {
min-height: 32px;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.