- objective-c - iOS 5 : Can you override UIAppearance customisations in specific classes?
- iphone - 如何将 CGFontRef 转换为 UIFont?
- ios - 以编程方式关闭标记的信息窗口 google maps iOS
- ios - Xcode 5 - 尝试验证存档时出现 "No application records were found"
https://plnkr.co/edit/aUYfOBJ0MdywKW2pphOM?p=preview
<md-select placeholder="food" style=""><!-- no width stylings that work -->
<md-option *ngFor="let food of foods" [value]="food.value">
{{ food.viewValue }}
</md-option>
</md-select>
请参阅上面的plunker。我在设置占位符为 'food' 的 md-select 宽度时遇到很多困难。为什么我不能在 md-select 标签中使用 style=""?我试过用一个没有响应的类来定位同一个 div。我也尝试过使用在 chrome、firefox 和 ie edge 的 F12 工具中可见的 .md-select-trigger 类。没有。
唯一有效的方法是取消选择浏览器工具区域中可用的 .md-select-trigger 类的最小宽度或 flex space-around。
我不确定我在这里处理的是什么。
最佳答案
可能有点晚了,但无论如何......要正确执行此操作,您需要设置 View Encapsulation在您的组件上设置为无:
@Component({
templateUrl: './my.component.html' ,
styleUrls: ['./my.component.css'],
encapsulation: ViewEncapsulation.None,
})
然后在你的组件 css 中你可以这样做:
.mat-select-trigger { min-width: 50px; }
来 self 发布的链接:
View Encapsulation = None means that Angular does no view encapsulation. Angular adds the CSS to the global styles. The scoping rules, isolations, and protections discussed earlier don't apply. This is essentially the same as pasting the component's styles into the HTML.
关于css - matSelect 的样式宽度困难,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42448078/
https://plnkr.co/edit/aUYfOBJ0MdywKW2pphOM?p=preview {{ food.viewValue }} 请参阅上面的
我正在使用 Angular v5 和 Angular Material。我有一个 mat-select 我想在选择一个选项后保持打开状态,因为我想通过单击特定按钮明确触发关闭。我试图将 (click)
我正在尝试在我的输入右侧添加一个简单的图标以清除他的内容。 我不想在我的列表中添加“无”选项。 我想添加一个“清除”按钮。 实际上,一切正常,但是当我单击清除按钮时,选择显示... 这是一个测试代码:
打开 MatSelect 时在常规页面中,可以通过 MAT_SELECT_SCROLL_STRATEGY 自定义滚动行为注入(inject) token 并使用 NoopScrollStrategy为
我正在尝试减小 mat-select 下拉面板的默认大小,但无法弄清楚如何去做 我试过给 width ,试过在 angular mat-select 中覆盖面板类,但尺寸似乎没有减小 我的模板文件
使用 Angular Material,我想在一段时间内禁用多个 中的复选框(因为数据是从 API 检索的)。我可以成功地做到这一点,但是复选框的 CSS 类不会变回。换句话说,复选框在功能上已启用,
我在我的项目中使用了 MatBlazor 框架。在 MatSelect 中,我想捕捉它的值 onchange 事件来做一些其他的工作。我尝试了一些解决方案,但 onchange 事件尚未触发。
工作人员还好吗? 我需要帮助,当值来自服务时,如何使用响应式(Reactive)表单在 Angular Material 的 MatSlected 组件中加载表单时设置值。我尝试了多种方法,但从未更新
我有一个嵌入 Angular Material MatSelect 元素的组件。 在我正在编写的测试中,我需要模拟某个选项的选择,并确保与该 MatSelect 元素关联的 selectionChan
我正在使用 Angular 9和添加的 Angular Material ,但是当我要使用垫选择时,我无法选择该选项并得到以下错误。 core.js:6241 ERROR TypeError: Can
我是一名优秀的程序员,十分优秀!