- 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"
我添加了 ::ng-deep
组合器来引用组件中的内容投影元素。但是当我从默认 (ViewEncapsulation.Emulated
) 切换到 ViewEncapsulation.ShadowDom
模式时,显然 ::ng-deep
不是原生 Shadow DOM 选择器,旧的 CSS 不起作用。
/* This works in ViewEncapsulation.Emulated */
:host ::ng-deep .course-description {
max-width: 360px;
margin: 0 auto;
margin-top: 15px;
user-select: none;
}
令人惊讶的是,当我使用 /deep/
组合器(已在 Chrome v63 https://developers.google.com/web/updates/2017/10/remove-shadow-piercing 中删除)时,对于 Chrome v75.0.3770 中的 ViewEncapsulation.ShadowDom
工作正常。 100
/* This works in ViewEncapsulation.ShadowDom */
:host /deep/ .course-description {
max-width: 360px;
margin: 0 auto;
margin-top: 15px;
user-select: none;
}
是否可以在组件 CSS 中使用 ::slotted()
使其像以前一样工作,但在 ViewEncapsulation.ShadowDom
模式下?如果是,如何?
最佳答案
你运气不好。 .Emulated 不支持::slotted。然而,它得到了支持。原生
ng-deep 也被弃用了,据我所知,目前还没有替代计划。
The shadow-piercing descendant combinator is deprecated and support is being removed from major browsers and tools. As such we plan to drop support in Angular (for all 3 of /deep/, >>> and ::ng-deep).
我仍然不确定,他们是在研究解决方案还是只是想让我们忘记它。
关于css - 如何在 Angular 的 ViewenCapsulation.ShadowDom 模式中使用::slotted?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56882246/
谁能解释一下 angular2ViewEncapsulation.Native、 ViewEncapsulation.None 和 ViewEncapsulation.Emulated 之间的区别强>
尝试更改封装时,会出现 Emulated、Native、None 和最后一个新的“ShadowDom”4 个选项。我知道 ViewEncapsulation.Native用于使用 Shadow DOM
Angular 的 ViewEncapsulation.ShadowDom 与 ViewEncapsulation.Emulated 有什么区别? 我了解 ViewEncapsulation.None
我最近一直在搞乱 ViewEncapsulation 和 ::ng-deep,遇到了两个不同的问题,这激起了我的好奇心。 假设我有一个组件: 从外部看,我可以通过以下方式为 toolti
在 Angular 中,默认模式是封装:ViewEncapsulation.Emulated 此模式通过使用 CSS 选择器启用样式封装。然而,'encapsulation: ViewEncapsul
我创建了一个新的 Angular CLI 元素和一个组件,我在其中尝试处理 css 特异性。在我尝试的地方,类样式会覆盖标签样式,但只有在 Angular 元素中它才起作用,反之亦然 我发现 View
在我当前的 Angular 7 应用程序中,我们正在努力处理来自库的组件,它需要一些 css 资源。我们不想将这些资源应用到我们应用程序的所有其余部分,而是应用到一个特定的组件,它的子组件和孙组件。
@Component({ ... ... ... encapsulations: ViewEncapsulation.None }) 当我使用 封装就像它与应用程序中其他组件中的默认样式冲突。 最佳答
我遇到的问题是,在尝试通过 ID 访问 html 元素时出现以下错误。当用户单击按钮以将不同的样式类应用于元素时,我尝试访问 classList。类列表和元素通常始终为空,除非我将 viewEncap
我添加了 ::ng-deep 组合器来引用组件中的内容投影元素。但是当我从默认 (ViewEncapsulation.Emulated) 切换到 ViewEncapsulation.ShadowDom
我在 firefox 和 edge 以及 ipad chrome 中使用 ViewEncapsulation.Native 加载 Angular 组件时遇到问题,在 mac 上的 safari、win
我正在尝试使用 styleUrls声明我的 Angular 2 组件以利用 View Encapsulation 时的属性但是在 Angular 完成初始化后将元素插入 DOM 时似乎出现了问题。 我
我想用 ViewEncapsulation.Native 制作组件,它使用 Bootstrap 4,而其他人使用 Bootstrap 3。这是 Bootstrap 4 的组件: import { Co
在 Material2 项目中,每个组件都使用 ViewEncapsulation.None。 (例如 MdButton ) 最近,md-toolbar 的封装刚刚更改为无. 为什么会这样?封装 CS
我必须通过单击按钮使 Angular2 组件看起来完全不同(不仅仅是颜色)。非常像不同的 CSS“皮肤”或“主题”。如果以后可以添加一些“皮肤”也很好。 我知道我可以简单地设置 ViewEncapsu
我安装了“react app 2”和 node-sass。它在 SCSS 上运行良好。但我只想知道如何创建组件特定的 SCSS,如 Angular(永远不会与其他组件 SCSS 发生冲突) Angul
我是一名优秀的程序员,十分优秀!