p-listbox:搜索过滤器文本框不适合宽度
p-listbox: search filter textbox does not fit to width
使用当前版本 8.0.2 的 PrimeNg 我遇到了列表框内搜索框的布局问题。显然这已在 3077 中解决。
我已经created a stackblitz example所以你可以看到它。
html代码是:
<p-listbox [options]="cities" [(ngModel)]="selectedCities" multiple="multiple" checkbox="checkbox" filter="filter" optionLabel="name"
[listStyle]="{'max-height':'150px', 'width':'300px'}">
<p-header>
Cities
</p-header>
</p-listbox>
bug 回来了吗?我错过了什么吗?
感谢您的帮助!
如文档中所示,问题在于混合了属性 [style]
和 [listStyle]
。
- style - Inline style of the container.
- styleClass - Style class of the container.
- listStyle - Inline style of the list element
.
所以内联样式应该分成 2 个不同的属性:
<p-listbox [options]="cities" [(ngModel)]="selectedCities" multiple="multiple" checkbox="checkbox" filter="filter" optionLabel="name"
[listStyle]="{'max-height':'150px'}"
[style]="{'width':'300px'}">
<p-header>
Cities
</p-header>
</p-listbox>
使用当前版本 8.0.2 的 PrimeNg 我遇到了列表框内搜索框的布局问题。显然这已在 3077 中解决。 我已经created a stackblitz example所以你可以看到它。
html代码是:
<p-listbox [options]="cities" [(ngModel)]="selectedCities" multiple="multiple" checkbox="checkbox" filter="filter" optionLabel="name"
[listStyle]="{'max-height':'150px', 'width':'300px'}">
<p-header>
Cities
</p-header>
</p-listbox>
bug 回来了吗?我错过了什么吗?
感谢您的帮助!
如文档中所示,问题在于混合了属性 [style]
和 [listStyle]
。
- style - Inline style of the container.
- styleClass - Style class of the container.
- listStyle - Inline style of the list element
.
所以内联样式应该分成 2 个不同的属性:
<p-listbox [options]="cities" [(ngModel)]="selectedCities" multiple="multiple" checkbox="checkbox" filter="filter" optionLabel="name"
[listStyle]="{'max-height':'150px'}"
[style]="{'width':'300px'}">
<p-header>
Cities
</p-header>
</p-listbox>