使用当前版本 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>
错误回来了吗?我错过了什么吗?
感谢您的帮助!
最佳答案
如文档中所示,问题在于混合了属性 [style]
和 [listStyle]
。
- style - Inline style of the container.
- styleClass - Style class of the container.
- listStyle - Inline style of the list element
.
所以内联样式应该分成两个不同的属性:
<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>
关于css - p-列表框 : search filter textbox does not fit to width,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57552986/